﻿<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                    xmlns:ed="http://schemas.microsoft.com/expression/2010/drawing" 
                    xmlns:params="clr-namespace:Elysium.Parameters;assembly=Elysium" 
                    xmlns:primitives="clr-namespace:Elysium.Controls.Primitives;assembly=Elysium" 
                    xmlns:controls="clr-namespace:Elysium.Controls;assembly=Elysium" 
                    xmlns:controls2="clr-namespace:Framework.UI.Controls"
                    xmlns:converters="clr-namespace:Elysium.Converters;assembly=Elysium">
    <ResourceDictionary.MergedDictionaries>
        <controls2:SharedResourceDictionary Source="/Framework.UI;component/Themes/WPF/Base/Converter.xaml" />
        <controls2:SharedResourceDictionary Source="/Framework.UI;component/Themes/WPF/Base/Color.xaml" />
        <controls2:SharedResourceDictionary Source="/Framework.UI;component/Themes/WPF/Base/Brush.xaml" />
    </ResourceDictionary.MergedDictionaries>

    <Style x:Key="FocusVisualStyle" TargetType="{x:Type Control}">
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate>
                    <Rectangle Margin="{TemplateBinding params:General.DefaultPadding}" 
                               Stroke="{StaticResource ForegroundBrush}" 
                               StrokeThickness="{TemplateBinding params:General.DefaultThicknessValue}" 
                               StrokeDashArray="2 1" 
                               RenderOptions.EdgeMode="Aliased" />
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <GeometryGroup x:Key="AdvancedIcon">
        <EllipseGeometry Center="3,3" RadiusX="2.5" RadiusY="2.5" />
        <EllipseGeometry Center="12,3" RadiusX="2.5" RadiusY="2.5" />
        <EllipseGeometry Center="21,3" RadiusX="2.5" RadiusY="2.5" />
    </GeometryGroup>
    <GeometryGroup x:Key="MinimizeIcon" FillRule="EvenOdd">
        <RectangleGeometry Rect="0,0,10,10" />
        <RectangleGeometry Rect="0,0,10,7" />
    </GeometryGroup>
    <GeometryGroup x:Key="MaximizeIcon">
        <LineGeometry StartPoint="0,0.5" EndPoint="10,0.5" />
        <LineGeometry StartPoint="0,1.5" EndPoint="10,1.5" />
        <LineGeometry StartPoint="0,2.5" EndPoint="10,2.5" />
        <LineGeometry StartPoint="0.5,3" EndPoint="0.5,10" />
        <LineGeometry StartPoint="9.5,3" EndPoint="9.5,10" />
        <LineGeometry StartPoint="1,9.5" EndPoint="9,9.5" />
    </GeometryGroup>
    <GeometryGroup x:Key="RestoreIcon">
        <LineGeometry StartPoint="3,0.5" EndPoint="10,0.5" />
        <LineGeometry StartPoint="3,1.5" EndPoint="10,1.5" />
        <LineGeometry StartPoint="3.5,2" EndPoint="3.5,3" />
        <LineGeometry StartPoint="9.5,2" EndPoint="9.5,7" />
        <LineGeometry StartPoint="7,6.5" EndPoint="10,6.5" />
        <LineGeometry StartPoint="0,3.5" EndPoint="7,3.5" />
        <LineGeometry StartPoint="0,4.5" EndPoint="7,4.5" />
        <LineGeometry StartPoint="0.5,5" EndPoint="0.5,10" />
        <LineGeometry StartPoint="6.5,5" EndPoint="6.5,10" />
        <LineGeometry StartPoint="1,9.5" EndPoint="6,9.5" />
    </GeometryGroup>
    <GeometryGroup x:Key="CloseIcon">
        <LineGeometry StartPoint="1,0" EndPoint="10,9" />
        <LineGeometry StartPoint="0,1" EndPoint="9,10" />
        <LineGeometry StartPoint="1,1" EndPoint="9,9" />
        <LineGeometry StartPoint="9,0" EndPoint="0,9" />
        <LineGeometry StartPoint="10,1" EndPoint="1,10" />
        <LineGeometry StartPoint="9,1" EndPoint="1,9" />
    </GeometryGroup>

    <Style x:Key="ButtonsBaseStyle" TargetType="{x:Type ButtonBase}" >
        <Setter Property="Background" Value="{StaticResource AccentBrush}" />
        <Setter Property="BorderBrush" Value="{StaticResource AccentBrush}" />
        <Setter Property="BorderThickness" Value="{Binding RelativeSource={RelativeSource Self},Path=(params:General.DefaultThickness),Mode=OneWay}" />
        <Setter Property="Foreground" Value="{StaticResource ContrastBrush}" />
        <Setter Property="FontSize" Value="{Binding RelativeSource={RelativeSource Self},Path=(params:General.ContentFontSize),Mode=OneWay}" />
        <Setter Property="FontStretch" Value="Medium" />
        <Setter Property="FontStyle" Value="Normal" />
        <Setter Property="FontWeight" Value="SemiBold" />
        <Setter Property="TextOptions.TextFormattingMode" Value="Display" />
        <Setter Property="TextOptions.TextRenderingMode" Value="ClearType" />
        <Setter Property="RenderOptions.ClearTypeHint" Value="Enabled" />
        <Setter Property="Focusable" Value="True" />
        <Setter Property="FocusVisualStyle" Value="{StaticResource FocusVisualStyle}" />
        <Setter Property="HorizontalContentAlignment" Value="Center" />
        <Setter Property="VerticalContentAlignment" Value="Center" />
        <Setter Property="Padding" Value="{Binding RelativeSource={RelativeSource Self},Path=(params:General.BoldPadding),Mode=OneWay}" />
        <Setter Property="MinWidth" Value="70" />
        <Setter Property="SnapsToDevicePixels" Value="True" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type ButtonBase}">
                    <Border Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" TextBlock.Foreground="{TemplateBinding Foreground}" TextBlock.FontFamily="{TemplateBinding Control.FontFamily}" TextBlock.FontSize="{TemplateBinding FontSize}" TextBlock.FontStretch="{TemplateBinding FontStretch}" TextBlock.FontStyle="{TemplateBinding FontStyle}" TextBlock.FontWeight="{TemplateBinding FontWeight}" TextOptions.TextFormattingMode="{TemplateBinding TextOptions.TextFormattingMode}" TextOptions.TextRenderingMode="{TemplateBinding TextOptions.TextRenderingMode}" RenderOptions.ClearTypeHint="{TemplateBinding RenderOptions.ClearTypeHint}" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}">
                        <ContentPresenter Margin="{TemplateBinding Padding}" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}" RecognizesAccessKey="True" />
                    </Border>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
        <Style.Triggers>
            <DataTrigger DataTrigger.Binding="{Binding RelativeSource={RelativeSource Self},Path=FontSize,Mode=OneWay,Converter={StaticResource IsGreaterThanConverter},ConverterParameter=18}">
                <Setter Property="TextOptions.TextFormattingMode" Value="Ideal" />
            </DataTrigger>
            <Trigger Property="IsMouseOver" Value="True">
                <Setter Property="Background" Value="{StaticResource ForegroundBrush}" />
                <Setter Property="BorderBrush" Value="{StaticResource ForegroundBrush}" />
                <Setter Property="Foreground" Value="{StaticResource BackgroundBrush}" />
            </Trigger>
            <Trigger Property="IsPressed" Value="True">
                <Setter Property="Background" Value="{StaticResource LowlightBrush}" />
                <Setter Property="BorderBrush" Value="{StaticResource LowlightBrush}" />
                <Setter Property="Foreground" Value="{StaticResource BackgroundBrush}" />
            </Trigger>
            <Trigger Property="IsEnabled" Value="False">
                <Setter Property="Background" Value="{StaticResource DisabledBrush}" />
                <Setter Property="BorderBrush" Value="{StaticResource DisabledBrush}" />
                <Setter Property="Foreground" Value="{StaticResource BackgroundBrush}" />
            </Trigger>
        </Style.Triggers>
    </Style>

    <Style x:Key="{x:Type Button}" TargetType="{x:Type Button}" BasedOn="{StaticResource ButtonsBaseStyle}" >
        <Style.Triggers>
            <Trigger Property="Button.IsDefault" Value="True">
                <Setter Property="FontWeight" Value="Bold" />
            </Trigger>
        </Style.Triggers>
    </Style>

    <Style x:Key="{x:Type RepeatButton}" TargetType="{x:Type RepeatButton}" BasedOn="{StaticResource ButtonsBaseStyle}"  />

    <Style x:Key="{x:Type ToggleButton}" TargetType="{x:Type ToggleButton}" BasedOn="{StaticResource ButtonsBaseStyle}" >
        <Style.Triggers>
            <Trigger Property="IsChecked" Value="True">
                <Setter Property="Background" Value="{StaticResource LowlightBrush}" />
                <Setter Property="BorderBrush" Value="{StaticResource LowlightBrush}" />
                <Setter Property="Foreground" Value="{StaticResource BackgroundBrush}" />
            </Trigger>
        </Style.Triggers>
    </Style>

    <!--<Style x:Key="{x:Type CheckBox}" TargetType="{x:Type CheckBox}">
        <Setter Property="Background" Value="{StaticResource BackgroundBrush}" />
        <Setter Property="BorderBrush" Value="{StaticResource MiddleLightBrush}" />
        <Setter Property="BorderThickness" Value="{Binding RelativeSource={RelativeSource Self},Path=(params:General.DefaultThickness),Mode=OneWay}" />
        <Setter Property="Foreground" Value="{StaticResource ForegroundBrush}" />
        <Setter Property="FontSize" Value="{Binding RelativeSource={RelativeSource Self},Path=(params:General.ContentFontSize),Mode=OneWay}" />
        <Setter Property="FontStretch" Value="Medium" />
        <Setter Property="FontStyle" Value="Normal" />
        <Setter Property="FontWeight" Value="Normal" />
        <Setter Property="FocusVisualStyle" Value="{StaticResource FocusVisualStyle}" />
        <Setter Property="HorizontalContentAlignment" Value="Left" />
        <Setter Property="VerticalContentAlignment" Value="Top" />
        <Setter Property="Padding" Value="{Binding RelativeSource={RelativeSource Self},Path=(params:General.BoldPadding),Mode=OneWay,Converter={StaticResource DoubleToThicknessConverter},ConverterParameter=Left}" />
        <Setter Property="SnapsToDevicePixels" Value="True" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type CheckBox}">
                    <BulletDecorator TextBlock.Foreground="{TemplateBinding Foreground}" 
                                     TextBlock.FontFamily="{TemplateBinding Control.FontFamily}" 
                                     TextBlock.FontSize="{TemplateBinding FontSize}" 
                                     TextBlock.FontWeight="{TemplateBinding FontWeight}" 
                                     Background="{StaticResource TransparentBrush}" 
                                     FlowDirection="{TemplateBinding FlowDirection}" 
                                     SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}">
                        <BulletDecorator.Bullet>
                            <Border Background="{TemplateBinding Background}"
                                    BorderBrush="{TemplateBinding BorderBrush}" 
                                    BorderThickness="{TemplateBinding BorderThickness}" 
                                    Height="{TemplateBinding params:Bullet.DecoratorSize}"
                                    Width="{TemplateBinding params:Bullet.DecoratorSize}">
                                <Grid>
                                    <Path x:Name="CheckBullet" 
                                          Height="{TemplateBinding params:CheckBox.CheckSize}"
                                          Stretch="Fill" 
                                          Stroke="{StaticResource AccentBrush}" 
                                          StrokeThickness="{TemplateBinding params:General.BoldThicknessValue}" 
                                          Visibility="Collapsed" 
                                          Width="{TemplateBinding params:CheckBox.CheckSize}">
                                        <Path.Data>
                                            <GeometryGroup>
                                                <LineGeometry StartPoint="0,3" EndPoint="4,8" />
                                                <LineGeometry StartPoint="4,8" EndPoint="8,0" />
                                            </GeometryGroup>
                                        </Path.Data>
                                    </Path>
                                    <Path x:Name="IndeterminateBullet" 
                                          Fill="{StaticResource AccentBrush}"
                                          Height="{TemplateBinding params:Bullet.Size}"
                                          Margin="2" 
                                          Stretch="Fill" 
                                          StrokeThickness="0" 
                                          Visibility="Collapsed" 
                                          Width="{TemplateBinding params:Bullet.Size}">
                                        <Path.Data>
                                            <GeometryGroup>
                                                <RectangleGeometry Rect="0,0,1,1" />
                                            </GeometryGroup>
                                        </Path.Data>
                                    </Path>
                                </Grid>
                            </Border>
                        </BulletDecorator.Bullet>
                        <Border Margin="{Binding RelativeSource={RelativeSource TemplatedParent},Path=(params:General.BoldPaddingValue),Mode=OneWay,Converter={StaticResource DoubleToThicknessConverter},ConverterParameter=Left}">
                            <ContentPresenter HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" 
                                              Margin="{TemplateBinding Padding}" 
                                              RecognizesAccessKey="True"
                                              VerticalAlignment="{TemplateBinding VerticalContentAlignment}"/>
                        </Border>
                    </BulletDecorator>
                    <ControlTemplate.Triggers>
                        <Trigger Property="IsChecked" Value="True">
                            <Setter TargetName="CheckBullet" Property="Visibility" Value="Visible" />
                        </Trigger>
                        <MultiTrigger>
                            <MultiTrigger.Conditions>
                                <Condition Property="IsThreeState" Value="True" />
                                <Condition Property="IsChecked" Value="{x:Null}" />
                            </MultiTrigger.Conditions>
                            <MultiTrigger.Setters>
                                <Setter TargetName="IndeterminateBullet" Property="Visibility" Value="Visible" />
                            </MultiTrigger.Setters>
                        </MultiTrigger>
                        <Trigger Property="IsEnabled" Value="False">
                            <Setter TargetName="CheckBullet" Value="{StaticResource DisabledBrush}" Property="Stroke" />
                            <Setter TargetName="IndeterminateBullet" Value="{StaticResource DisabledBrush}" Property="Fill" />
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
        <Style.Triggers>
            <Trigger Property="IsMouseOver" Value="True">
                <Setter Property="Background" Value="{StaticResource HighlightBrush}" />
                <Setter Property="BorderBrush" Value="{StaticResource MiddleLightBrush}" />
            </Trigger>
            <Trigger Property="IsPressed" Value="True">
                <Setter Property="Background" Value="{StaticResource HighlightBrush}" />
                <Setter Property="BorderBrush" Value="{StaticResource LowlightBrush}" />
            </Trigger>
            <Trigger Property="IsEnabled" Value="False">
                <Setter Property="Background" Value="{StaticResource BackgroundBrush}" />
                <Setter Property="BorderBrush" Value="{StaticResource DisabledBrush}" />
                <Setter Property="Foreground" Value="{StaticResource DisabledBrush}" />
            </Trigger>
        </Style.Triggers>
    </Style>-->

    <!--<Style x:Key="{x:Type RadioButton}" TargetType="{x:Type RadioButton}" >
        <Setter Property="Background" Value="{StaticResource BackgroundBrush}" />
        <Setter Property="BorderBrush" Value="{StaticResource MiddleLightBrush}" />
        <Setter Property="BorderThickness" Value="{Binding RelativeSource={RelativeSource Self},Path=(params:General.DefaultThickness),Mode=OneWay}" />
        <Setter Property="Foreground" Value="{StaticResource ForegroundBrush}" />
        <Setter Property="FontSize" Value="{Binding RelativeSource={RelativeSource Self},Path=(params:General.ContentFontSize),Mode=OneWay}" />
        <Setter Property="FontStretch" Value="Medium" />
        <Setter Property="FontStyle" Value="Normal" />
        <Setter Property="FontWeight" Value="Normal" />
        <Setter Property="FocusVisualStyle" Value="{StaticResource FocusVisualStyle}" />
        <Setter Property="HorizontalContentAlignment" Value="Left" />
        <Setter Property="VerticalContentAlignment" Value="Top" />
        <Setter Property="Padding" Value="{Binding RelativeSource={RelativeSource Self},Path=(params:General.BoldPadding),Mode=OneWay,Converter={StaticResource DoubleToThicknessConverter},ConverterParameter=Left}" />
        <Setter Property="SnapsToDevicePixels" Value="True" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type RadioButton}">
                    <BulletDecorator Background="{StaticResource TransparentBrush}" 
                                     TextBlock.Foreground="{TemplateBinding Foreground}" 
                                     TextBlock.FontFamily="{TemplateBinding Control.FontFamily}" 
                                     TextBlock.FontSize="{TemplateBinding FontSize}" 
                                     TextBlock.FontWeight="{TemplateBinding FontWeight}" 
                                     FlowDirection="{TemplateBinding FlowDirection}" 
                                     SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}">
                        <BulletDecorator.Bullet>
                            <Grid Height="{TemplateBinding params:Bullet.DecoratorSize}"
                                  Width="{TemplateBinding params:Bullet.DecoratorSize}">
                                <Ellipse Fill="{TemplateBinding Background}" 
                                         Stroke="{TemplateBinding BorderBrush}" 
                                         StrokeThickness="{Binding RelativeSource={RelativeSource TemplatedParent},Path=BorderThickness,Mode=OneWay,Converter={StaticResource ThicknessToDoubleConverter}}"/>
                                <Ellipse x:Name="CheckBullet" 
                                         Fill="{StaticResource AccentBrush}" 
                                         Height="{TemplateBinding params:Bullet.Size}"
                                         HorizontalAlignment="Center" 
                                         StrokeThickness="0"
                                         VerticalAlignment="Center" 
                                         Visibility="Collapsed" 
                                         Width="{TemplateBinding params:Bullet.Size}"/>
                            </Grid>
                        </BulletDecorator.Bullet>
                        <Border Margin="{Binding RelativeSource={RelativeSource TemplatedParent},Path=(params:General.BoldPaddingValue),Mode=OneWay,Converter={StaticResource DoubleToThicknessConverter},ConverterParameter=Left}">
                            <ContentPresenter HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" 
                                              Margin="{TemplateBinding Padding}" 
                                              RecognizesAccessKey="True" 
                                              VerticalAlignment="{TemplateBinding VerticalContentAlignment}" />
                        </Border>
                    </BulletDecorator>
                    <ControlTemplate.Triggers>
                        <Trigger Property="IsChecked" Value="True">
                            <Setter TargetName="CheckBullet" Property="Visibility" Value="Visible" />
                        </Trigger>
                        <Trigger Property="IsEnabled" Value="False">
                            <Setter TargetName="CheckBullet" Value="{StaticResource DisabledBrush}" Property="Fill" />
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
        <Style.Triggers>
            <Trigger Property="IsMouseOver" Value="True">
                <Setter Property="Background" Value="{StaticResource HighlightBrush}" />
                <Setter Property="BorderBrush" Value="{StaticResource MiddleLightBrush}" />
            </Trigger>
            <Trigger Property="IsPressed" Value="True">
                <Setter Property="Background" Value="{StaticResource HighlightBrush}" />
                <Setter Property="BorderBrush" Value="{StaticResource LowlightBrush}" />
            </Trigger>
            <Trigger Property="IsEnabled" Value="False">
                <Setter Property="Background" Value="{StaticResource BackgroundBrush}" />
                <Setter Property="BorderBrush" Value="{StaticResource DisabledBrush}" />
                <Setter Property="Foreground" Value="{StaticResource DisabledBrush}" />
            </Trigger>
        </Style.Triggers>
    </Style>-->



    <!--<Style x:Key="ScrollBarLineDownButtonStyle" TargetType="{x:Type RepeatButton}" >
        <Setter Property="Background" Value="{StaticResource TransparentBrush}" />
        <Setter Property="BorderBrush" Value="{StaticResource MiddleLightBrush}" />
        <Setter Property="BorderThickness" Value="{Binding RelativeSource={RelativeSource Self},Path=(params:General.DefaultThickness),Mode=OneWay}" />
        <Setter Property="FocusVisualStyle" Value="{x:Null}" />
        <Setter Property="Focusable" Value="False" />
        <Setter Property="Stylus.IsFlicksEnabled" Value="False" />
        <Setter Property="Stylus.IsPressAndHoldEnabled" Value="False" />
        <Setter Property="SnapsToDevicePixels" Value="True" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type RepeatButton}">
                    <Border Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding Background}" BorderThickness="{TemplateBinding BorderThickness}" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}">
                        <Polygon Polygon.Points="0,0 3,4 6,0" Fill="{TemplateBinding BorderBrush}" StrokeThickness="0" Stretch="Uniform" Width="{Binding RelativeSource={RelativeSource AncestorType={x:Type ScrollBar}},Path=(params:ScrollBar.ArrowSize),Mode=OneWay}" Height="{Binding RelativeSource={RelativeSource AncestorType={x:Type ScrollBar}},Path=(params:ScrollBar.ArrowSize),Mode=OneWay}" />
                    </Border>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
        <Style.Triggers>
            <Trigger Property="IsMouseOver" Value="True">
                <Setter Property="BorderBrush" Value="{StaticResource LowlightBrush}" />
            </Trigger>
            <Trigger Property="IsPressed" Value="True">
                <Setter Property="BorderBrush" Value="{StaticResource ForegroundBrush}" />
            </Trigger>
            <Trigger Property="IsEnabled" Value="False">
                <Setter Property="BorderBrush" Value="{StaticResource DisabledBrush}" />
            </Trigger>
        </Style.Triggers>
    </Style>
    <Style x:Key="ScrollBarLineUpButtonStyle" TargetType="{x:Type RepeatButton}" BasedOn="{StaticResource ScrollBarLineDownButtonStyle}" >
        <Setter Property="FrameworkElement.LayoutTransform">
            <Setter.Value>
                <RotateTransform RotateTransform.Angle="180" />
            </Setter.Value>
        </Setter>
    </Style>
    <Style x:Key="ScrollBarLineLeftButtonStyle" TargetType="{x:Type RepeatButton}" BasedOn="{StaticResource ScrollBarLineDownButtonStyle}" >
        <Setter Property="FrameworkElement.LayoutTransform">
            <Setter.Value>
                <RotateTransform RotateTransform.Angle="-90" />
            </Setter.Value>
        </Setter>
    </Style>
    <Style x:Key="ScrollBarLineRightButtonStyle" TargetType="{x:Type RepeatButton}" BasedOn="{StaticResource ScrollBarLineDownButtonStyle}" >
        <Setter Property="FrameworkElement.LayoutTransform">
            <Setter.Value>
                <RotateTransform RotateTransform.Angle="90" />
            </Setter.Value>
        </Setter>
    </Style>
    <Style x:Key="ScrollBarPageButtonStyle" TargetType="{x:Type RepeatButton}" >
        <Setter Property="Background" Value="{StaticResource TransparentBrush}" />
        <Setter Property="BorderBrush" Value="{StaticResource TransparentBrush}" />
        <Setter Property="BorderThickness" Value="0" />
        <Setter Property="FocusVisualStyle" Value="{x:Null}" />
        <Setter Property="Focusable" Value="False" />
        <Setter Property="Stylus.IsFlicksEnabled" Value="False" />
        <Setter Property="Stylus.IsPressAndHoldEnabled" Value="False" />
        <Setter Property="SnapsToDevicePixels" Value="True" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type RepeatButton}">
                    <Rectangle Fill="{TemplateBinding Background}" Stroke="{TemplateBinding BorderBrush}" StrokeThickness="0" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
    <Style x:Key="ScrollBarThumbStyle" TargetType="{x:Type Thumb}" >
        <Setter Property="Background" Value="{StaticResource MiddleLightBrush}" />
        <Setter Property="BorderBrush" Value="{StaticResource TransparentBrush}" />
        <Setter Property="BorderThickness" Value="0" />
        <Setter Property="FocusVisualStyle" Value="{x:Null}" />
        <Setter Property="Focusable" Value="False" />
        <Setter Property="Stylus.IsFlicksEnabled" Value="False" />
        <Setter Property="Stylus.IsPressAndHoldEnabled" Value="False" />
        <Setter Property="Padding" Value="{Binding RelativeSource={RelativeSource Self},Path=(params:General.DefaultPaddingValue),Mode=OneWay,Converter={StaticResource DoubleToThicknessConverter},ConverterParameter=Left}" />
        <Setter Property="SnapsToDevicePixels" Value="True" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type Thumb}">
                    <Grid SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}">
                        <Rectangle Fill="{TemplateBinding Background}" Stroke="{TemplateBinding BorderBrush}" StrokeThickness="0" Margin="{TemplateBinding Padding}" />
                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
        <Style.Triggers>
            <Trigger Property="IsMouseOver" Value="True">
                <Setter Property="Background" Value="{StaticResource LowlightBrush}" />
            </Trigger>
            <Trigger Property="Thumb.IsDragging" Value="True">
                <Setter Property="Background" Value="{StaticResource ForegroundBrush}" />
            </Trigger>
            <Trigger Property="IsEnabled" Value="False">
                <Setter Property="Background" Value="{StaticResource DisabledBrush}" />
            </Trigger>
        </Style.Triggers>
    </Style>
    <ControlTemplate x:Key="HorizontalScrollBarTemplate" TargetType="{x:Type ScrollBar}" >
        <Border Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}">
            <Grid>
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="Auto" />
                    <ColumnDefinition Width="*" />
                    <ColumnDefinition Width="Auto" />
                </Grid.ColumnDefinitions>
                <RepeatButton Grid.Column="0" ButtonBase.Command="{x:Static ScrollBar.LineLeftCommand}" IsEnabled="{TemplateBinding IsEnabled}" FrameworkElement.Style="{StaticResource ScrollBarLineLeftButtonStyle}" Visibility="Collapsed" />
                <Track x:Name="PART_Track" Grid.Column="1">
                    <Track.DecreaseRepeatButton>
                        <RepeatButton ButtonBase.Command="{x:Static ScrollBar.PageLeftCommand}" IsEnabled="{TemplateBinding IsEnabled}" FrameworkElement.Style="{StaticResource ScrollBarPageButtonStyle}" />
                    </Track.DecreaseRepeatButton>
                    <Track.Thumb>
                        <Thumb IsEnabled="{TemplateBinding IsEnabled}" FrameworkElement.Style="{StaticResource ScrollBarThumbStyle}" />
                    </Track.Thumb>
                    <Track.IncreaseRepeatButton>
                        <RepeatButton ButtonBase.Command="{x:Static ScrollBar.PageRightCommand}" IsEnabled="{TemplateBinding IsEnabled}" FrameworkElement.Style="{StaticResource ScrollBarPageButtonStyle}" />
                    </Track.IncreaseRepeatButton>
                </Track>
                <RepeatButton Grid.Column="2" ButtonBase.Command="{x:Static ScrollBar.LineRightCommand}" IsEnabled="{TemplateBinding IsEnabled}" FrameworkElement.Style="{StaticResource ScrollBarLineRightButtonStyle}" Visibility="Collapsed" />
            </Grid>
        </Border>
    </ControlTemplate>
    <ControlTemplate x:Key="VerticalScrollBarTemplate" TargetType="{x:Type ScrollBar}" >
        <Border Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}">
            <Grid>
                <Grid.RowDefinitions>
                    <RowDefinition Height="Auto" />
                    <RowDefinition Height="*" />
                    <RowDefinition Height="Auto" />
                </Grid.RowDefinitions>
                <RepeatButton Grid.Row="0" ButtonBase.Command="{x:Static ScrollBar.LineUpCommand}" IsEnabled="{TemplateBinding IsEnabled}" FrameworkElement.Style="{StaticResource ScrollBarLineUpButtonStyle}" Visibility="Collapsed" />
                <Track x:Name="PART_Track" Grid.Row="1" Track.IsDirectionReversed="True">
                    <Track.DecreaseRepeatButton>
                        <RepeatButton ButtonBase.Command="{x:Static ScrollBar.PageUpCommand}" IsEnabled="{TemplateBinding IsEnabled}" FrameworkElement.Style="{StaticResource ScrollBarPageButtonStyle}" />
                    </Track.DecreaseRepeatButton>
                    <Track.Thumb>
                        <Thumb IsEnabled="{TemplateBinding IsEnabled}" FrameworkElement.Style="{StaticResource ScrollBarThumbStyle}" />
                    </Track.Thumb>
                    <Track.IncreaseRepeatButton>
                        <RepeatButton ButtonBase.Command="{x:Static ScrollBar.PageDownCommand}" IsEnabled="{TemplateBinding IsEnabled}" FrameworkElement.Style="{StaticResource ScrollBarPageButtonStyle}" />
                    </Track.IncreaseRepeatButton>
                </Track>
                <RepeatButton Grid.Row="2" ButtonBase.Command="{x:Static ScrollBar.LineDownCommand}" IsEnabled="{TemplateBinding IsEnabled}" FrameworkElement.Style="{StaticResource ScrollBarLineDownButtonStyle}" Visibility="Collapsed" />
            </Grid>
        </Border>
    </ControlTemplate>
    <Style x:Key="{x:Type ScrollBar}" TargetType="{x:Type ScrollBar}" >
        <Setter Property="Background" Value="{StaticResource TransparentBrush}" />
        <Setter Property="BorderBrush" Value="{StaticResource MiddleLightBrush}" />
        <Setter Property="FocusVisualStyle" Value="{x:Null}" />
        <Setter Property="Focusable" Value="False" />
        <Setter Property="Stylus.IsFlicksEnabled" Value="False" />
        <Setter Property="Stylus.IsPressAndHoldEnabled" Value="False" />
        <Setter Property="SnapsToDevicePixels" Value="True" />
        <Style.Triggers>
            <Trigger Property="ScrollBar.Orientation" Value="Horizontal">
                <Setter Property="BorderThickness" Value="{Binding RelativeSource={RelativeSource Self},Path=(params:General.DefaultPaddingValue),Mode=OneWay,Converter={StaticResource DoubleToThicknessConverter},ConverterParameter=Bottom}" />
                <Setter Property="MinHeight" Value="6" />
                <Setter Property="Height" Value="6" />
                <Setter Property="MaxHeight" Value="10" />
                <Setter Property="Template" Value="{StaticResource HorizontalScrollBarTemplate}" />
            </Trigger>
            <Trigger Property="ScrollBar.Orientation" Value="Vertical">
                <Setter Property="BorderThickness" Value="{Binding RelativeSource={RelativeSource Self},Path=(params:General.DefaultPaddingValue),Mode=OneWay,Converter={StaticResource DoubleToThicknessConverter},ConverterParameter=Right}" />
                <Setter Property="MinWidth" Value="6" />
                <Setter Property="Width" Value="6" />
                <Setter Property="MaxWidth" Value="10" />
                <Setter Property="Template" Value="{StaticResource VerticalScrollBarTemplate}" />
            </Trigger>
        </Style.Triggers>
    </Style>-->



    <!--<Style x:Key="{x:Type ScrollViewer}" TargetType="{x:Type ScrollViewer}" >
        <Setter Property="Background" Value="{StaticResource BackgroundBrush}" />
        <Setter Property="BorderBrush" Value="{StaticResource MiddleLightBrush}" />
        <Setter Property="BorderThickness" Value="0" />
        <Setter Property="Foreground" Value="{StaticResource ForegroundBrush}" />
        <Setter Property="FontSize" Value="{Binding RelativeSource={RelativeSource Self},Path=(params:General.TextFontSize),Mode=OneWay}" />
        <Setter Property="FontStretch" Value="Medium" />
        <Setter Property="FontStyle" Value="Normal" />
        <Setter Property="FontWeight" Value="Normal" />
        <Setter Property="TextOptions.TextFormattingMode" Value="Display" />
        <Setter Property="TextOptions.TextRenderingMode" Value="ClearType" />
        <Setter Property="RenderOptions.ClearTypeHint" Value="Enabled" />
        <Setter Property="HorizontalContentAlignment" Value="Stretch" />
        <Setter Property="VerticalContentAlignment" Value="Stretch" />
        <Setter Property="Padding" Value="0" />
        <Setter Property="SnapsToDevicePixels" Value="True" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type ScrollViewer}">
                    <Border Background="{TemplateBinding Background}" 
                            BorderBrush="{TemplateBinding BorderBrush}" 
                            BorderThickness="{TemplateBinding BorderThickness}" 
                            TextBlock.Foreground="{TemplateBinding Foreground}" 
                            TextBlock.FontSize="{TemplateBinding FontSize}" 
                            TextBlock.FontStretch="{TemplateBinding FontStretch}" 
                            TextBlock.FontStyle="{TemplateBinding FontStyle}" 
                            TextBlock.FontWeight="{TemplateBinding FontWeight}" 
                            TextOptions.TextFormattingMode="{TemplateBinding TextOptions.TextFormattingMode}" 
                            TextOptions.TextRenderingMode="{TemplateBinding TextOptions.TextRenderingMode}" 
                            SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}">
                        <Grid>
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="*" />
                                <ColumnDefinition Width="Auto" />
                            </Grid.ColumnDefinitions>
                            <Grid.RowDefinitions>
                                <RowDefinition Height="*" />
                                <RowDefinition Height="Auto" />
                            </Grid.RowDefinitions>
                            <ScrollContentPresenter x:Name="PART_ScrollContentPresenter" 
                                                    Grid.Column="0" 
                                                    Grid.Row="0" 
                                                    Content="{TemplateBinding Content}" 
                                                    ContentTemplate="{TemplateBinding ContentTemplate}" 
                                                    CanContentScroll="{TemplateBinding CanContentScroll}" 
                                                    CanHorizontallyScroll="False" 
                                                    CanVerticallyScroll="False" 
                                                    Margin="{TemplateBinding Padding}" />
                            <ScrollBar x:Name="PART_HorizontalScrollBar" 
                                       Grid.Column="0" 
                                       Grid.Row="1" 
                                       AutomationProperties.AutomationId="HorizontalScrollBar" 
                                       Cursor="Arrow" 
                                       Orientation="Horizontal" 
                                       Minimum="0" 
                                       Maximum="{TemplateBinding ScrollableWidth}" 
                                       Value="{TemplateBinding HorizontalOffset}" 
                                       ViewportSize="{TemplateBinding ViewportWidth}" 
                                       Visibility="{TemplateBinding ComputedHorizontalScrollBarVisibility}" />
                            <ScrollBar x:Name="PART_VerticalScrollBar" 
                                       Grid.Column="1" 
                                       Grid.Row="0" 
                                       AutomationProperties.AutomationId="VerticalScrollBar" 
                                       Cursor="Arrow" 
                                       Orientation="Vertical" 
                                       Minimum="0" 
                                       Maximum="{TemplateBinding ScrollableHeight}" 
                                       Value="{TemplateBinding VerticalOffset}" 
                                       ViewportSize="{TemplateBinding ViewportHeight}" 
                                       Visibility="{TemplateBinding ComputedVerticalScrollBarVisibility}" />
                        </Grid>
                    </Border>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
        <Style.Triggers>
            <DataTrigger Binding="{Binding RelativeSource={RelativeSource Self},Path=FontSize,Mode=OneWay,Converter={StaticResource IsGreaterThanConverter},ConverterParameter=18}">
                <Setter Property="TextOptions.TextFormattingMode" Value="Ideal" />
            </DataTrigger>
        </Style.Triggers>
    </Style>-->

    <Style x:Key="{x:Static MenuItem.SeparatorStyleKey}" TargetType="{x:Type Separator}">
        <Setter Property="Background" Value="{StaticResource TransparentBrush}"/>
        <Setter Property="BorderBrush" Value="{StaticResource AccentBrush}"/>
        <Setter Property="BorderThickness" Value="{Binding RelativeSource={RelativeSource Self}, Path=(params:General.DefaultThickness), Mode=OneWay}"/>
        <Setter Property="Focusable" Value="False"/>
        <Setter Property="FocusVisualStyle" Value="{x:Null}"/>
        <Setter Property="HorizontalContentAlignment" Value="Stretch"/>
        <Setter Property="VerticalContentAlignment" Value="Stretch"/>
        <Setter Property="Padding" Value="{Binding RelativeSource={RelativeSource Self}, Path=(params:General.BoldPaddingValue), Mode=OneWay}"/>
        <Setter Property="OverridesDefaultStyle" Value="True"/>
        <Setter Property="SnapsToDevicePixels" Value="True"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type Separator}">
                    <Border Background="{TemplateBinding Background}"
                            BorderThickness="0"
                            SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}">
                        <Line Stroke="{TemplateBinding BorderBrush}"
                              StrokeThickness="{Binding BorderThickness, RelativeSource={RelativeSource TemplatedParent}, Converter={StaticResource ThicknessToDoubleConverter}}"
                              X1="0" Y1="0"
                              X2="1" Y2="0"
                              Stretch="Fill"
                              Margin="{TemplateBinding Padding}"
                              HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
                              VerticalAlignment="{TemplateBinding VerticalContentAlignment}"/>
                    </Border>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
    <ControlTemplate x:Key="{x:Static MenuItem.TopLevelHeaderTemplateKey}" TargetType="{x:Type MenuItem}">
        <Border x:Name="LayoutRoot"
                Background="{TemplateBinding Background}"
                BorderBrush="{TemplateBinding BorderBrush}"
                BorderThickness="{TemplateBinding BorderThickness}"
                SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}">
            <Grid x:Name="ContentHost"
                  TextBlock.Foreground="{TemplateBinding Foreground}"
                  TextBlock.FontFamily="{TemplateBinding FontFamily}"
                  TextBlock.FontSize="{TemplateBinding FontSize}"
                  TextBlock.FontStretch="{TemplateBinding FontStretch}"
                  TextBlock.FontStyle="{TemplateBinding FontStyle}"
                  TextBlock.FontWeight="{TemplateBinding FontWeight}"
                  TextOptions.TextFormattingMode="{TemplateBinding TextOptions.TextFormattingMode}"
                  TextOptions.TextRenderingMode="{TemplateBinding TextOptions.TextRenderingMode}"
                  RenderOptions.ClearTypeHint="{TemplateBinding RenderOptions.ClearTypeHint}">
                <ContentPresenter x:Name="HeaderHost"
                                  ContentSource="Header"
                                  RecognizesAccessKey="True"
                                  Margin="{TemplateBinding Padding}"
                                  HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
                                  VerticalAlignment="{TemplateBinding VerticalContentAlignment}"/>
                <Popup x:Name="PART_Popup"
                       Grid.IsSharedSizeScope="True"
                       AllowsTransparency="True"
                       Focusable="False"
                       IsOpen="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=IsSubmenuOpen, Mode=TwoWay}"
                       Placement="Custom"
                       PlacementTarget="{Binding ElementName=LayoutRoot}"
                       CustomPopupPlacementCallback="{x:Static params:DropDown.PopupPlacementCallback}">
                    <Border x:Name="PopupRoot"
                            Tag="{DynamicResource {x:Static SystemParameters.DropShadowKey}}"
                            SnapsToDevicePixels="True">
                        <Grid>
                            <Border Background="{Binding RelativeSource={RelativeSource AncestorType={x:Type MenuBase}}, Path=(params:MenuBase.SubmenuBackground)}"
                                    BorderBrush="{Binding RelativeSource={RelativeSource AncestorType={x:Type MenuBase}}, Path=(params:MenuBase.SubmenuBorderBrush)}"
                                    BorderThickness="{Binding RelativeSource={RelativeSource AncestorType={x:Type MenuBase}}, Path=(params:MenuBase.SubmenuBorderThickness)}"
                                    TextBlock.Foreground="{Binding RelativeSource={RelativeSource AncestorType={x:Type MenuBase}}, Path=Foreground}"
                                    TextBlock.FontFamily="{Binding RelativeSource={RelativeSource AncestorType={x:Type MenuBase}}, Path=FontFamily}"
                                    TextBlock.FontSize="{Binding RelativeSource={RelativeSource AncestorType={x:Type MenuBase}}, Path=FontSize}"
                                    TextBlock.FontStretch="{Binding RelativeSource={RelativeSource AncestorType={x:Type MenuBase}}, Path=FontStretch}"
                                    TextBlock.FontStyle="{Binding RelativeSource={RelativeSource AncestorType={x:Type MenuBase}}, Path=FontStyle}"
                                    TextBlock.FontWeight="{Binding RelativeSource={RelativeSource AncestorType={x:Type MenuBase}}, Path=FontWeight}"
                                    TextOptions.TextFormattingMode="{Binding RelativeSource={RelativeSource AncestorType={x:Type MenuBase}}, Path=(TextOptions.TextFormattingMode)}"
                                    TextOptions.TextRenderingMode="{Binding RelativeSource={RelativeSource AncestorType={x:Type MenuBase}}, Path=(TextOptions.TextRenderingMode)}"
                                    RenderOptions.ClearTypeHint="{Binding RelativeSource={RelativeSource AncestorType={x:Type MenuBase}}, Path=(RenderOptions.ClearTypeHint)}"
                                    HorizontalAlignment="Stretch"
                                    VerticalAlignment="Stretch">
                                <StackPanel IsItemsHost="True"
                                            KeyboardNavigation.DirectionalNavigation="Cycle"/>
                            </Border>
                            <Rectangle x:Name="PopupMask"
                                       Fill="{Binding RelativeSource={RelativeSource AncestorType={x:Type MenuBase}}, Path=(params:MenuBase.SubmenuBackground)}"
                                       Margin="{Binding RelativeSource={RelativeSource AncestorType={x:Type MenuBase}}, Path=(params:MenuBase.SubmenuBorderThickness), Converter={StaticResource ThicknessConverter}, ConverterParameter='Left'}"
                                       HorizontalAlignment="Left"
                                       VerticalAlignment="Top"
                                       Width="{Binding ElementName=ContentHost, Path=ActualWidth}"/>
                        </Grid>
                    </Border>
                </Popup>
            </Grid>
        </Border>
        <ControlTemplate.Triggers>
            <Trigger Property="IsSubmenuOpen" Value="True">
                <Setter TargetName="PART_Popup" Property="params:DropDown.IsOpen" Value="True"/>
            </Trigger>
            <Trigger SourceName="PART_Popup" Property="IsOpen" Value="True">
                <Setter TargetName="LayoutRoot" Property="Background" Value="{Binding RelativeSource={RelativeSource AncestorType={x:Type MenuBase}}, Path=(params:MenuBase.SubmenuBackground)}"/>
                <Setter TargetName="LayoutRoot" Property="BorderBrush" Value="{Binding RelativeSource={RelativeSource AncestorType={x:Type MenuBase}}, Path=(params:MenuBase.SubmenuBorderBrush)}"/>
            </Trigger>
            <MultiTrigger>
                <MultiTrigger.Conditions>
                    <Condition SourceName="PART_Popup" Property="IsOpen" Value="True"/>
                    <Condition SourceName="PART_Popup" Property="params:DropDown.IsDefaultHorizontalPosition" Value="True"/>
                    <Condition SourceName="PART_Popup" Property="params:DropDown.IsDefaultVerticalPosition" Value="True"/>
                </MultiTrigger.Conditions>
                <MultiTrigger.Setters>
                    <Setter TargetName="LayoutRoot" Property="BorderThickness" Value="{Binding RelativeSource={RelativeSource AncestorType={x:Type MenuBase}}, Path=(params:MenuBase.SubmenuBorderThickness), Converter={StaticResource ThicknessConverter}, ConverterParameter='Left, Top, Right'}"/>
                    <Setter TargetName="PopupMask" Property="Height" Value="{Binding RelativeSource={RelativeSource AncestorType={x:Type MenuBase}}, Path=(params:MenuBase.SubmenuBorderThickness), Converter={StaticResource ThicknessToDoubleConverter}, ConverterParameter='Top'}"/>
                </MultiTrigger.Setters>
            </MultiTrigger>
            <MultiTrigger>
                <MultiTrigger.Conditions>
                    <Condition SourceName="PART_Popup" Property="IsOpen" Value="True"/>
                    <Condition SourceName="PART_Popup" Property="params:DropDown.IsDefaultHorizontalPosition" Value="True"/>
                    <Condition SourceName="PART_Popup" Property="params:DropDown.IsDefaultVerticalPosition" Value="False"/>
                </MultiTrigger.Conditions>
                <MultiTrigger.Setters>
                    <Setter TargetName="LayoutRoot" Property="BorderThickness" Value="{Binding RelativeSource={RelativeSource AncestorType={x:Type MenuBase}}, Path=(params:MenuBase.SubmenuBorderThickness), Converter={StaticResource ThicknessConverter}, ConverterParameter='Left, Right, Bottom'}"/>
                    <Setter TargetName="PopupMask" Property="Height" Value="{Binding RelativeSource={RelativeSource AncestorType={x:Type MenuBase}}, Path=(params:MenuBase.SubmenuBorderThickness), Converter={StaticResource ThicknessToDoubleConverter}, ConverterParameter='Bottom'}"/>
                    <Setter TargetName="PopupMask" Property="VerticalAlignment" Value="Bottom"/>
                </MultiTrigger.Setters>
            </MultiTrigger>
            <MultiDataTrigger>
                <MultiDataTrigger.Conditions>
                    <Condition Binding="{Binding ElementName=PopupRoot, Path=Tag}" Value="True"/>
                    <Condition Binding="{Binding ElementName=PART_Popup, Path=(params:DropDown.IsDefaultVerticalPosition)}" Value="True"/>
                </MultiDataTrigger.Conditions>
                <MultiDataTrigger.Setters>
                    <Setter TargetName="PopupRoot" Property="Effect">
                        <Setter.Value>
                            <DropShadowEffect Color="{Binding RelativeSource={RelativeSource AncestorType={x:Type MenuBase}}, Path=(params:General.ShadowBrush).(SolidColorBrush.Color)}"
                                                          BlurRadius="4" ShadowDepth="2"
                                                          Direction="315"
                                                          Opacity="0.3"/>
                        </Setter.Value>
                    </Setter>
                    <Setter TargetName="PopupRoot" Property="Background" Value="{StaticResource TransparentBrush}"/>
                    <Setter TargetName="PopupRoot" Property="Padding" Value="0,0,6,6"/>
                </MultiDataTrigger.Setters>
            </MultiDataTrigger>
            <MultiDataTrigger>
                <MultiDataTrigger.Conditions>
                    <Condition Binding="{Binding ElementName=PopupRoot, Path=Tag}" Value="True"/>
                    <Condition Binding="{Binding ElementName=PART_Popup, Path=(params:DropDown.IsDefaultVerticalPosition)}" Value="False"/>
                </MultiDataTrigger.Conditions>
                <MultiDataTrigger.Setters>
                    <Setter TargetName="PopupRoot" Property="Effect">
                        <Setter.Value>
                            <DropShadowEffect Color="{Binding RelativeSource={RelativeSource AncestorType={x:Type MenuBase}}, Path=(params:General.ShadowBrush).(SolidColorBrush.Color)}"
                                                          BlurRadius="4" ShadowDepth="0"
                                                          Direction="45"
                                                          Opacity="0.3"/>
                        </Setter.Value>
                    </Setter>
                    <Setter TargetName="PopupRoot" Property="Background" Value="{StaticResource TransparentBrush}"/>
                    <Setter TargetName="PopupRoot" Property="Padding" Value="0,4,4,0"/>
                </MultiDataTrigger.Setters>
            </MultiDataTrigger>
        </ControlTemplate.Triggers>
    </ControlTemplate>
    <ControlTemplate x:Key="{x:Static MenuItem.TopLevelItemTemplateKey}" TargetType="{x:Type MenuItem}">
        <Border x:Name="LayoutRoot"
                Background="{TemplateBinding Background}"
                BorderBrush="{TemplateBinding BorderBrush}"
                BorderThickness="{TemplateBinding BorderThickness}"
                TextBlock.Foreground="{TemplateBinding Foreground}"
                TextBlock.FontFamily="{TemplateBinding FontFamily}"
                TextBlock.FontSize="{TemplateBinding FontSize}"
                TextBlock.FontStretch="{TemplateBinding FontStretch}"
                TextBlock.FontStyle="{TemplateBinding FontStyle}"
                TextBlock.FontWeight="{TemplateBinding FontWeight}"
                TextOptions.TextFormattingMode="{TemplateBinding TextOptions.TextFormattingMode}"
                TextOptions.TextRenderingMode="{TemplateBinding TextOptions.TextRenderingMode}"
                RenderOptions.ClearTypeHint="{TemplateBinding RenderOptions.ClearTypeHint}"
                SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}">
            <ContentPresenter x:Name="HeaderHost"
                                ContentSource="Header"
                                RecognizesAccessKey="True"
                                Margin="{TemplateBinding Padding}"/>
        </Border>
    </ControlTemplate>
    <ControlTemplate x:Key="{x:Static MenuItem.SubmenuHeaderTemplateKey}" TargetType="{x:Type MenuItem}">
        <Border x:Name="LayoutRoot"
                Background="{TemplateBinding Background}"
                BorderBrush="{TemplateBinding BorderBrush}"
                BorderThickness="{TemplateBinding BorderThickness}"
                SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}">
            <Grid TextBlock.Foreground="{TemplateBinding Foreground}"
                  TextBlock.FontFamily="{TemplateBinding FontFamily}"
                  TextBlock.FontSize="{TemplateBinding FontSize}"
                  TextBlock.FontStretch="{TemplateBinding FontStretch}"
                  TextBlock.FontStyle="{TemplateBinding FontStyle}"
                  TextBlock.FontWeight="{TemplateBinding FontWeight}"
                  TextOptions.TextFormattingMode="{TemplateBinding TextOptions.TextFormattingMode}"
                  TextOptions.TextRenderingMode="{TemplateBinding TextOptions.TextRenderingMode}"
                  RenderOptions.ClearTypeHint="{TemplateBinding RenderOptions.ClearTypeHint}"
                  Margin="{TemplateBinding Padding}"
                  HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
                  VerticalAlignment="{TemplateBinding VerticalContentAlignment}">
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="Auto"
                                      SharedSizeGroup="ContextMenuIconSizeGroup"/>
                    <ColumnDefinition Width="*"/>
                    <ColumnDefinition Width="Auto"/>
                </Grid.ColumnDefinitions>
                <ContentPresenter x:Name="IconHost"
                                  Grid.Column="0"
                                  ContentSource="Icon"
                                  HorizontalAlignment="Left"
                                  VerticalAlignment="Center"
                                  MinWidth="16" MinHeight="16"/>
                <ContentPresenter x:Name="HeaderHost"
                                  Grid.Column="1"
                                  ContentSource="Header"
                                  RecognizesAccessKey="True"
                                  Margin="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=(params:General.BoldPaddingValue), Mode=OneWay, Converter={StaticResource DoubleToThicknessConverter}, ConverterParameter='Left, Right'}"
                                  HorizontalAlignment="Left"
                                  VerticalAlignment="Center"/>
                <Polygon x:Name="ArrowGlyph"
                         Grid.Column="2"
                         Fill="{StaticResource AccentBrush}"
                         StrokeThickness="0"
                         Stretch="Uniform"
                         Margin="{TemplateBinding params:MenuItem.ArrowMargin}"
                         HorizontalAlignment="Right" VerticalAlignment="Center"
                         Width="{TemplateBinding params:MenuItem.ArrowSize}"
                         Height="{TemplateBinding params:MenuItem.ArrowSize}">
                    <Polygon.Points>
                        <PointCollection>
                            <Point X="0" Y="0"/>
                            <Point X="2" Y="2"/>
                            <Point X="0" Y="4"/>
                        </PointCollection>
                    </Polygon.Points>
                </Polygon>
                <Popup x:Name="PART_Popup"
                       Grid.Column="0" Grid.IsSharedSizeScope="True"
                       AllowsTransparency="True"
                       Focusable="False"
                       Placement="Right"
                       PlacementTarget="{Binding ElementName=LayoutRoot}"
                       IsOpen="{TemplateBinding IsSubmenuOpen}"
                       PopupAnimation="{DynamicResource {x:Static SystemParameters.MenuPopupAnimationKey}}"
                       Tag="{DynamicResource {x:Static SystemParameters.MenuAnimationKey}}">
                    <Border x:Name="PopupRoot"
                            Tag="{DynamicResource {x:Static SystemParameters.DropShadowKey}}">
                        <Border Background="{Binding RelativeSource={RelativeSource AncestorType={x:Type MenuBase}}, Path=(params:MenuBase.SubmenuBackground)}"
                                BorderBrush="{Binding RelativeSource={RelativeSource AncestorType={x:Type MenuBase}}, Path=(params:MenuBase.SubmenuBorderBrush)}"
                                BorderThickness="{Binding RelativeSource={RelativeSource AncestorType={x:Type MenuBase}}, Path=(params:MenuBase.SubmenuBorderThickness)}"
                                TextBlock.Foreground="{Binding RelativeSource={RelativeSource AncestorType={x:Type MenuBase}}, Path=Foreground}"
                                TextBlock.FontFamily="{Binding RelativeSource={RelativeSource AncestorType={x:Type MenuBase}}, Path=FontFamily}"
                                TextBlock.FontSize="{Binding RelativeSource={RelativeSource AncestorType={x:Type MenuBase}}, Path=FontSize}"
                                TextBlock.FontStretch="{Binding RelativeSource={RelativeSource AncestorType={x:Type MenuBase}}, Path=FontStretch}"
                                TextBlock.FontStyle="{Binding RelativeSource={RelativeSource AncestorType={x:Type MenuBase}}, Path=FontStyle}"
                                TextBlock.FontWeight="{Binding RelativeSource={RelativeSource AncestorType={x:Type MenuBase}}, Path=FontWeight}"
                                TextOptions.TextFormattingMode="{Binding RelativeSource={RelativeSource AncestorType={x:Type MenuBase}}, Path=(TextOptions.TextFormattingMode)}"
                                TextOptions.TextRenderingMode="{Binding RelativeSource={RelativeSource AncestorType={x:Type MenuBase}}, Path=(TextOptions.TextRenderingMode)}"
                                RenderOptions.ClearTypeHint="{Binding RelativeSource={RelativeSource AncestorType={x:Type MenuBase}}, Path=(RenderOptions.ClearTypeHint)}"
                                SnapsToDevicePixels="{Binding RelativeSource={RelativeSource AncestorType={x:Type MenuBase}}, Path=SnapsToDevicePixels}">
                            <StackPanel IsItemsHost="True"
                                        KeyboardNavigation.DirectionalNavigation="Cycle"
                                        HorizontalAlignment="Stretch"
                                        VerticalAlignment="Stretch"/>
                        </Border>
                    </Border>
                </Popup>
            </Grid>
        </Border>
        <ControlTemplate.Triggers>
            <Trigger Property="Icon" Value="{x:Null}">
                <Setter TargetName="IconHost" Property="Visibility" Value="Collapsed"/>
            </Trigger>
            <Trigger Property="IsSubmenuOpen" Value="True">
                <Setter TargetName="ArrowGlyph" Property="Fill" Value="{StaticResource AccentBrush}"/>
            </Trigger>
            <Trigger Property="IsSuspendingPopupAnimation" Value="True">
                <Setter TargetName="PART_Popup" Property="PopupAnimation" Value="None"/>
            </Trigger>
            <Trigger SourceName="PART_Popup" Property="Tag" Value="False">
                <Setter TargetName="PART_Popup" Property="PopupAnimation" Value="None"/>
            </Trigger>
            <DataTrigger Binding="{Binding ElementName=PopupRoot, Path=Tag}" Value="True">
                <Setter TargetName="PopupRoot" Property="Effect">
                    <Setter.Value>
                        <DropShadowEffect Color="{Binding RelativeSource={RelativeSource AncestorType={x:Type MenuBase}}, Path=(params:General.ShadowBrush).(SolidColorBrush.Color)}"
                                          BlurRadius="4" ShadowDepth="2"
                                          Direction="315"
                                          Opacity="0.3"/>
                    </Setter.Value>
                </Setter>
                <Setter TargetName="PopupRoot" Property="Background" Value="{StaticResource TransparentBrush}"/>
                <Setter TargetName="PopupRoot" Property="Padding" Value="0,0,6,6"/>
            </DataTrigger>
        </ControlTemplate.Triggers>
    </ControlTemplate>
    <ControlTemplate x:Key="{x:Static MenuItem.SubmenuItemTemplateKey}" TargetType="{x:Type MenuItem}">
        <Border Background="{TemplateBinding Background}"
                BorderBrush="{TemplateBinding BorderBrush}"
                BorderThickness="{TemplateBinding BorderThickness}"
                SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}">
            <Grid TextBlock.Foreground="{TemplateBinding Foreground}"
                  TextBlock.FontFamily="{TemplateBinding FontFamily}"
                  TextBlock.FontSize="{TemplateBinding FontSize}"
                  TextBlock.FontStretch="{TemplateBinding FontStretch}"
                  TextBlock.FontStyle="{TemplateBinding FontStyle}"
                  TextBlock.FontWeight="{TemplateBinding FontWeight}"
                  TextOptions.TextFormattingMode="{TemplateBinding TextOptions.TextFormattingMode}"
                  TextOptions.TextRenderingMode="{TemplateBinding TextOptions.TextRenderingMode}"
                  RenderOptions.ClearTypeHint="{TemplateBinding RenderOptions.ClearTypeHint}"
                  Margin="{TemplateBinding Padding}"
                  HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
                  VerticalAlignment="{TemplateBinding VerticalContentAlignment}">
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="Auto"
                                      SharedSizeGroup="ContextMenuIconSizeGroup"/>
                    <ColumnDefinition Width="*"/>
                    <ColumnDefinition Width="Auto"
                                      SharedSizeGroup="ContextMenuShortcutSizeGroup"/>
                </Grid.ColumnDefinitions>
                <Path x:Name="CheckBullet"
                      Grid.Column="0"
                      Stroke="{StaticResource HighlightBrush}"
                      StrokeThickness="{TemplateBinding params:General.BoldThicknessValue}"
                      Stretch="Uniform"
                      Visibility="Collapsed"
                      HorizontalAlignment="Center" VerticalAlignment="Center"
                      Width="{TemplateBinding params:MenuItem.BulletSize}" Height="{TemplateBinding params:MenuItem.BulletSize}">
                    <Path.Data>
                        <GeometryGroup>
                            <LineGeometry StartPoint="0,3" EndPoint="4,8"/>
                            <LineGeometry StartPoint="4,8" EndPoint="8,0"/>
                        </GeometryGroup>
                    </Path.Data>
                </Path>
                <ContentPresenter x:Name="IconHost"
                                  Grid.Column="0"
                                  ContentSource="Icon"
                                  HorizontalAlignment="Left"
                                  VerticalAlignment="Center"
                                  MinWidth="16" MinHeight="16"/>
                <ContentPresenter x:Name="HeaderHost"
                                  Grid.Column="1"
                                  ContentSource="Header"
                                  RecognizesAccessKey="True"
                                  Margin="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=(params:General.BoldPaddingValue), Mode=OneWay, Converter={StaticResource DoubleToThicknessConverter}, ConverterParameter='Left, Right'}"
                                  HorizontalAlignment="Left"
                                  VerticalAlignment="Center"/>
                <TextBlock Grid.Column="2"
                           Text="{TemplateBinding InputGestureText}"
                           Margin="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=(params:General.BoldPaddingValue), Mode=OneWay, Converter={StaticResource DoubleToThicknessConverter}, ConverterParameter='Left, Right'}"
                           HorizontalAlignment="Left"
                           VerticalAlignment="Center"/>
            </Grid>
        </Border>
        <ControlTemplate.Triggers>
            <Trigger Property="Icon" Value="{x:Null}">
                <Setter TargetName="IconHost" Property="Visibility" Value="Collapsed"/>
            </Trigger>
            <Trigger Property="IsCheckable" Value="True">
                <Setter TargetName="IconHost" Property="Visibility" Value="Collapsed"/>
            </Trigger>
            <Trigger Property="IsChecked" Value="True">
                <Setter TargetName="CheckBullet" Property="Visibility" Value="Visible"/>
            </Trigger>
        </ControlTemplate.Triggers>
    </ControlTemplate>
    
    <Style x:Key="{x:Type MenuItem}" TargetType="{x:Type MenuItem}">
        <Setter Property="Background" Value="Transparent"/>
        <Setter Property="BorderBrush" Value="Transparent"/>
        <Setter Property="BorderThickness" Value="0"/>
        <Setter Property="Foreground" Value="{Binding Foreground, Mode=OneWay, RelativeSource={RelativeSource FindAncestor, AncestorLevel=1, AncestorType={x:Type MenuBase}}}"/>
        <Setter Property="FontFamily" Value="{Binding FontFamily, Mode=OneWay, RelativeSource={RelativeSource FindAncestor, AncestorLevel=1, AncestorType={x:Type MenuBase}}}"/>
        <Setter Property="FontSize" Value="{Binding FontSize, Mode=OneWay, RelativeSource={RelativeSource FindAncestor, AncestorLevel=1, AncestorType={x:Type MenuBase}}}"/>
        <Setter Property="FontStretch" Value="{Binding FontStretch, Mode=OneWay, RelativeSource={RelativeSource FindAncestor, AncestorLevel=1, AncestorType={x:Type MenuBase}}}"/>
        <Setter Property="FontStyle" Value="{Binding FontStyle, Mode=OneWay, RelativeSource={RelativeSource FindAncestor, AncestorLevel=1, AncestorType={x:Type MenuBase}}}"/>
        <Setter Property="FontWeight" Value="{Binding FontWeight, Mode=OneWay, RelativeSource={RelativeSource FindAncestor, AncestorLevel=1, AncestorType={x:Type MenuBase}}}"/>
        <Setter Property="TextOptions.TextFormattingMode" Value="{Binding (TextOptions.TextFormattingMode), Mode=OneWay, RelativeSource={RelativeSource FindAncestor, AncestorLevel=1, AncestorType={x:Type MenuBase}}}"/>
        <Setter Property="TextOptions.TextRenderingMode" Value="{Binding (TextOptions.TextRenderingMode), Mode=OneWay, RelativeSource={RelativeSource FindAncestor, AncestorLevel=1, AncestorType={x:Type MenuBase}}}"/>
        <Setter Property="RenderOptions.ClearTypeHint" Value="{Binding (RenderOptions.ClearTypeHint), Mode=OneWay, RelativeSource={RelativeSource FindAncestor, AncestorLevel=1, AncestorType={x:Type MenuBase}}}"/>
        <Setter Property="Focusable" Value="True"/>
        <Setter Property="FocusVisualStyle">
            <Setter.Value>
                <Style TargetType="{x:Type Control}">
                    <Setter Property="Template">
                        <Setter.Value>
                            <ControlTemplate>
                                <Rectangle RenderOptions.EdgeMode="Aliased" Margin="{TemplateBinding params:General.DefaultPadding}" Stroke="Black" StrokeThickness="{TemplateBinding params:General.DefaultThicknessValue}" StrokeDashArray="2 1"/>
                            </ControlTemplate>
                        </Setter.Value>
                    </Setter>
                </Style>
            </Setter.Value>
        </Setter>
        <Setter Property="Stylus.IsFlicksEnabled" Value="False"/>
        <Setter Property="ScrollViewer.PanningMode" Value="Both"/>
        <Setter Property="HorizontalContentAlignment" Value="{Binding HorizontalContentAlignment, RelativeSource={RelativeSource FindAncestor, AncestorLevel=1, AncestorType={x:Type MenuBase}}}"/>
        <Setter Property="VerticalContentAlignment" Value="{Binding VerticalContentAlignment, RelativeSource={RelativeSource FindAncestor, AncestorLevel=1, AncestorType={x:Type MenuBase}}}"/>
        <Setter Property="Padding" Value="{Binding Padding, Mode=OneWay, RelativeSource={RelativeSource FindAncestor, AncestorLevel=1, AncestorType={x:Type MenuBase}}}"/>
        <Setter Property="SnapsToDevicePixels" Value="True"/>
        <Style.Triggers>
            <Trigger Property="Role" Value="TopLevelHeader">
                <Setter Property="Template">
                    <Setter.Value>
                        <ControlTemplate TargetType="{x:Type MenuItem}">
                            <Border x:Name="LayoutRoot" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}">
                                <Grid x:Name="ContentHost" RenderOptions.ClearTypeHint="{TemplateBinding RenderOptions.ClearTypeHint}" TextElement.Foreground="{TemplateBinding Foreground}" TextElement.FontWeight="{TemplateBinding FontWeight}" TextElement.FontStyle="{TemplateBinding FontStyle}" TextElement.FontStretch="{TemplateBinding FontStretch}" TextElement.FontSize="{TemplateBinding FontSize}" TextElement.FontFamily="{TemplateBinding FontFamily}" TextOptions.TextRenderingMode="{TemplateBinding TextOptions.TextRenderingMode}" TextOptions.TextFormattingMode="{TemplateBinding TextOptions.TextFormattingMode}">
                                    <ContentPresenter x:Name="HeaderHost" ContentTemplate="{TemplateBinding HeaderTemplate}" Content="{TemplateBinding Header}" ContentStringFormat="{TemplateBinding HeaderStringFormat}" ContentSource="Header" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" Margin="{TemplateBinding Padding}" RecognizesAccessKey="True" VerticalAlignment="{TemplateBinding VerticalContentAlignment}"/>
                                    <Popup x:Name="PART_Popup" AllowsTransparency="True" CustomPopupPlacementCallback="&lt;.cctor&gt;b__0" Focusable="False" IsOpen="{Binding IsSubmenuOpen, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}" Grid.IsSharedSizeScope="True" Placement="Custom">
                                        <Border x:Name="PopupRoot" SnapsToDevicePixels="True" Tag="{DynamicResource {x:Static SystemParameters.DropShadowKey}}">
                                            <Grid>
                                                <Border BorderBrush="{Binding (params:MenuBase.SubmenuBorderBrush), RelativeSource={RelativeSource FindAncestor, AncestorLevel=1, AncestorType={x:Type MenuBase}}}" BorderThickness="{Binding (params:MenuBase.SubmenuBorderThickness), RelativeSource={RelativeSource FindAncestor, AncestorLevel=1, AncestorType={x:Type MenuBase}}}" Background="{Binding (params:MenuBase.SubmenuBackground), RelativeSource={RelativeSource FindAncestor, AncestorLevel=1, AncestorType={x:Type MenuBase}}}" RenderOptions.ClearTypeHint="{Binding (RenderOptions.ClearTypeHint), RelativeSource={RelativeSource FindAncestor, AncestorLevel=1, AncestorType={x:Type MenuBase}}}" TextElement.Foreground="{Binding Foreground, RelativeSource={RelativeSource FindAncestor, AncestorLevel=1, AncestorType={x:Type MenuBase}}}" TextElement.FontWeight="{Binding FontWeight, RelativeSource={RelativeSource FindAncestor, AncestorLevel=1, AncestorType={x:Type MenuBase}}}" TextElement.FontStyle="{Binding FontStyle, RelativeSource={RelativeSource FindAncestor, AncestorLevel=1, AncestorType={x:Type MenuBase}}}" TextElement.FontStretch="{Binding FontStretch, RelativeSource={RelativeSource FindAncestor, AncestorLevel=1, AncestorType={x:Type MenuBase}}}" TextElement.FontSize="{Binding FontSize, RelativeSource={RelativeSource FindAncestor, AncestorLevel=1, AncestorType={x:Type MenuBase}}}" TextElement.FontFamily="{Binding FontFamily, RelativeSource={RelativeSource FindAncestor, AncestorLevel=1, AncestorType={x:Type MenuBase}}}" HorizontalAlignment="Stretch" TextOptions.TextRenderingMode="{Binding (TextOptions.TextRenderingMode), RelativeSource={RelativeSource FindAncestor, AncestorLevel=1, AncestorType={x:Type MenuBase}}}" TextOptions.TextFormattingMode="{Binding (TextOptions.TextFormattingMode), RelativeSource={RelativeSource FindAncestor, AncestorLevel=1, AncestorType={x:Type MenuBase}}}" VerticalAlignment="Stretch">
                                                    <StackPanel KeyboardNavigation.DirectionalNavigation="Cycle" IsItemsHost="True"/>
                                                </Border>
                                                <Rectangle x:Name="PopupMask" Fill="{Binding (params:MenuBase.SubmenuBackground), RelativeSource={RelativeSource FindAncestor, AncestorLevel=1, AncestorType={x:Type MenuBase}}}" HorizontalAlignment="Left" VerticalAlignment="Top" Width="{Binding ActualWidth, ElementName=ContentHost}">
                                                    <Rectangle.Margin>
                                                        <Binding Converter="{StaticResource ThicknessConverter}" ConverterParameter="Left" Path="(params:MenuBase.SubmenuBorderThickness)" RelativeSource="{RelativeSource FindAncestor, AncestorLevel=1, AncestorType={x:Type MenuBase}}"/>
                                                    </Rectangle.Margin>
                                                </Rectangle>
                                            </Grid>
                                        </Border>
                                    </Popup>
                                </Grid>
                            </Border>
                            <ControlTemplate.Triggers>
                                <Trigger Property="IsSubmenuOpen" Value="True">
                                    <Setter Property="params:DropDown.IsOpen" TargetName="PART_Popup" Value="True"/>
                                </Trigger>
                                <Trigger Property="IsOpen" SourceName="PART_Popup" Value="True">
                                    <Setter Property="Background" TargetName="LayoutRoot" Value="{Binding (params:MenuBase.SubmenuBackground), RelativeSource={RelativeSource FindAncestor, AncestorLevel=1, AncestorType={x:Type MenuBase}}}"/>
                                    <Setter Property="BorderBrush" TargetName="LayoutRoot" Value="{Binding (params:MenuBase.SubmenuBorderBrush), RelativeSource={RelativeSource FindAncestor, AncestorLevel=1, AncestorType={x:Type MenuBase}}}"/>
                                </Trigger>
                                <MultiTrigger>
                                    <MultiTrigger.Conditions>
                                        <Condition Property="IsOpen" SourceName="PART_Popup" Value="True"/>
                                        <Condition Property="params:DropDown.IsDefaultHorizontalPosition" SourceName="PART_Popup" Value="True"/>
                                        <Condition Property="params:DropDown.IsDefaultVerticalPosition" SourceName="PART_Popup" Value="True"/>
                                    </MultiTrigger.Conditions>
                                    <Setter Property="BorderThickness" TargetName="LayoutRoot">
                                        <Setter.Value>
                                            <Binding Converter="{StaticResource ThicknessConverter}" ConverterParameter="Left, Top, Right" Path="(params:MenuBase.SubmenuBorderThickness)" RelativeSource="{RelativeSource FindAncestor, AncestorLevel=1, AncestorType={x:Type MenuBase}}"/>
                                        </Setter.Value>
                                    </Setter>
                                    <Setter Property="Height" TargetName="PopupMask">
                                        <Setter.Value>
                                            <Binding Converter="{StaticResource ThicknessToDoubleConverter}" ConverterParameter="Top" Path="(params:MenuBase.SubmenuBorderThickness)" RelativeSource="{RelativeSource FindAncestor, AncestorLevel=1, AncestorType={x:Type MenuBase}}"/>
                                        </Setter.Value>
                                    </Setter>
                                </MultiTrigger>
                                <MultiTrigger>
                                    <MultiTrigger.Conditions>
                                        <Condition Property="IsOpen" SourceName="PART_Popup" Value="True"/>
                                        <Condition Property="params:DropDown.IsDefaultHorizontalPosition" SourceName="PART_Popup" Value="True"/>
                                        <Condition Property="params:DropDown.IsDefaultVerticalPosition" SourceName="PART_Popup" Value="False"/>
                                    </MultiTrigger.Conditions>
                                    <Setter Property="BorderThickness" TargetName="LayoutRoot">
                                        <Setter.Value>
                                            <Binding Converter="{StaticResource ThicknessConverter}" ConverterParameter="Left, Right, Bottom" Path="(params:MenuBase.SubmenuBorderThickness)" RelativeSource="{RelativeSource FindAncestor, AncestorLevel=1, AncestorType={x:Type MenuBase}}"/>
                                        </Setter.Value>
                                    </Setter>
                                    <Setter Property="Height" TargetName="PopupMask">
                                        <Setter.Value>
                                            <Binding Converter="{StaticResource ThicknessToDoubleConverter}" ConverterParameter="Bottom" Path="(params:MenuBase.SubmenuBorderThickness)" RelativeSource="{RelativeSource FindAncestor, AncestorLevel=1, AncestorType={x:Type MenuBase}}"/>
                                        </Setter.Value>
                                    </Setter>
                                    <Setter Property="VerticalAlignment" TargetName="PopupMask" Value="Bottom"/>
                                </MultiTrigger>
                                <MultiDataTrigger>
                                    <MultiDataTrigger.Conditions>
                                        <Condition Binding="{Binding Tag, ElementName=PopupRoot}" Value="True"/>
                                        <Condition Binding="{Binding (params:DropDown.IsDefaultVerticalPosition), ElementName=PART_Popup}" Value="True"/>
                                    </MultiDataTrigger.Conditions>
                                    <Setter Property="Effect" TargetName="PopupRoot">
                                        <Setter.Value>
                                            <DropShadowEffect BlurRadius="4" Color="{Binding (params:General.ShadowBrush).(SolidColorBrush.Color), RelativeSource={RelativeSource FindAncestor, AncestorLevel=1, AncestorType={x:Type MenuBase}}}" Direction="315" Opacity="0.3" ShadowDepth="2"/>
                                        </Setter.Value>
                                    </Setter>
                                    <Setter Property="Background" TargetName="PopupRoot" Value="Transparent"/>
                                    <Setter Property="Padding" TargetName="PopupRoot" Value="0,0,6,6"/>
                                </MultiDataTrigger>
                                <MultiDataTrigger>
                                    <MultiDataTrigger.Conditions>
                                        <Condition Binding="{Binding Tag, ElementName=PopupRoot}" Value="True"/>
                                        <Condition Binding="{Binding (params:DropDown.IsDefaultVerticalPosition), ElementName=PART_Popup}" Value="False"/>
                                    </MultiDataTrigger.Conditions>
                                    <Setter Property="Effect" TargetName="PopupRoot">
                                        <Setter.Value>
                                            <DropShadowEffect BlurRadius="4" Color="{Binding (params:General.ShadowBrush).(SolidColorBrush.Color), RelativeSource={RelativeSource FindAncestor, AncestorLevel=1, AncestorType={x:Type MenuBase}}}" Direction="45" Opacity="0.3" ShadowDepth="0"/>
                                        </Setter.Value>
                                    </Setter>
                                    <Setter Property="Background" TargetName="PopupRoot" Value="Transparent"/>
                                    <Setter Property="Padding" TargetName="PopupRoot" Value="0,4,4,0"/>
                                </MultiDataTrigger>
                            </ControlTemplate.Triggers>
                        </ControlTemplate>
                    </Setter.Value>
                </Setter>
                <Setter Property="BorderThickness">
                    <Setter.Value>
                        <Binding Converter="{StaticResource ThicknessConverter}" ConverterParameter="Left, Top, Right" Path="(params:MenuBase.SubmenuBorderThickness)" RelativeSource="{RelativeSource FindAncestor, AncestorLevel=1, AncestorType={x:Type MenuBase}}"/>
                    </Setter.Value>
                </Setter>
            </Trigger>
            <Trigger Property="Role" Value="TopLevelItem">
                <Setter Property="Template">
                    <Setter.Value>
                        <ControlTemplate TargetType="{x:Type MenuItem}">
                            <Border x:Name="LayoutRoot" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}" RenderOptions.ClearTypeHint="{TemplateBinding RenderOptions.ClearTypeHint}" TextElement.Foreground="{TemplateBinding Foreground}" TextElement.FontWeight="{TemplateBinding FontWeight}" TextElement.FontStyle="{TemplateBinding FontStyle}" TextElement.FontStretch="{TemplateBinding FontStretch}" TextElement.FontSize="{TemplateBinding FontSize}" TextElement.FontFamily="{TemplateBinding FontFamily}" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" TextOptions.TextRenderingMode="{TemplateBinding TextOptions.TextRenderingMode}" TextOptions.TextFormattingMode="{TemplateBinding TextOptions.TextFormattingMode}">
                                <ContentPresenter x:Name="HeaderHost" ContentTemplate="{TemplateBinding HeaderTemplate}" Content="{TemplateBinding Header}" ContentStringFormat="{TemplateBinding HeaderStringFormat}" ContentSource="Header" Margin="{TemplateBinding Padding}" RecognizesAccessKey="True"/>
                            </Border>
                        </ControlTemplate>
                    </Setter.Value>
                </Setter>
                <Setter Property="BorderThickness">
                    <Setter.Value>
                        <Binding Converter="{StaticResource ThicknessConverter}" ConverterParameter="Left, Top, Right" Path="(params:MenuBase.SubmenuBorderThickness)" RelativeSource="{RelativeSource FindAncestor, AncestorLevel=1, AncestorType={x:Type MenuBase}}"/>
                    </Setter.Value>
                </Setter>
            </Trigger>
            <Trigger Property="Role" Value="SubmenuHeader">
                <Setter Property="Template">
                    <Setter.Value>
                        <ControlTemplate TargetType="{x:Type MenuItem}">
                            <Border x:Name="LayoutRoot" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}">
                                <Grid RenderOptions.ClearTypeHint="{TemplateBinding RenderOptions.ClearTypeHint}" TextElement.Foreground="{TemplateBinding Foreground}" TextElement.FontWeight="{TemplateBinding FontWeight}" TextElement.FontStyle="{TemplateBinding FontStyle}" TextElement.FontStretch="{TemplateBinding FontStretch}" TextElement.FontSize="{TemplateBinding FontSize}" TextElement.FontFamily="{TemplateBinding FontFamily}" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" Margin="{TemplateBinding Padding}" TextOptions.TextRenderingMode="{TemplateBinding TextOptions.TextRenderingMode}" TextOptions.TextFormattingMode="{TemplateBinding TextOptions.TextFormattingMode}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}">
                                    <Grid.ColumnDefinitions>
                                        <ColumnDefinition SharedSizeGroup="ContextMenuIconSizeGroup" Width="Auto"/>
                                        <ColumnDefinition Width="*"/>
                                        <ColumnDefinition Width="Auto"/>
                                    </Grid.ColumnDefinitions>
                                    <ContentPresenter x:Name="IconHost" Content="{TemplateBinding Icon}" Grid.Column="0" ContentSource="Icon" HorizontalAlignment="Left" MinWidth="16" MinHeight="16" VerticalAlignment="Center"/>
                                    <ContentPresenter x:Name="HeaderHost" ContentTemplate="{TemplateBinding HeaderTemplate}" Content="{TemplateBinding Header}" Grid.Column="1" ContentStringFormat="{TemplateBinding HeaderStringFormat}" ContentSource="Header" HorizontalAlignment="Left" RecognizesAccessKey="True" VerticalAlignment="Center">
                                        <ContentPresenter.Margin>
                                            <Binding Converter="{StaticResource DoubleToThicknessConverter}" ConverterParameter="Left, Right" Mode="OneWay" Path="(params:General.BoldPaddingValue)" RelativeSource="{RelativeSource TemplatedParent}"/>
                                        </ContentPresenter.Margin>
                                    </ContentPresenter>
                                    <Polygon x:Name="ArrowGlyph" Grid.Column="2" Fill="#FF777777" HorizontalAlignment="Right" Height="{TemplateBinding params:MenuItem.ArrowSize}" Margin="{TemplateBinding params:MenuItem.ArrowMargin}" Points="0,0 2,2 0,4" Stretch="Uniform" StrokeThickness="0" VerticalAlignment="Center" Width="{TemplateBinding params:MenuItem.ArrowSize}"/>
                                    <Popup x:Name="PART_Popup" AllowsTransparency="True" Grid.Column="0" Focusable="False" IsOpen="{TemplateBinding IsSubmenuOpen}" Grid.IsSharedSizeScope="True" PopupAnimation="{DynamicResource {x:Static SystemParameters.MenuPopupAnimationKey}}" Placement="Right" Tag="{DynamicResource {x:Static SystemParameters.MenuAnimationKey}}">
                                        <Border x:Name="PopupRoot" Tag="{DynamicResource {x:Static SystemParameters.DropShadowKey}}">
                                            <Border BorderBrush="{Binding (params:MenuBase.SubmenuBorderBrush), RelativeSource={RelativeSource FindAncestor, AncestorLevel=1, AncestorType={x:Type MenuBase}}}" BorderThickness="{Binding (params:MenuBase.SubmenuBorderThickness), RelativeSource={RelativeSource FindAncestor, AncestorLevel=1, AncestorType={x:Type MenuBase}}}" Background="{Binding (params:MenuBase.SubmenuBackground), RelativeSource={RelativeSource FindAncestor, AncestorLevel=1, AncestorType={x:Type MenuBase}}}" RenderOptions.ClearTypeHint="{Binding (RenderOptions.ClearTypeHint), RelativeSource={RelativeSource FindAncestor, AncestorLevel=1, AncestorType={x:Type MenuBase}}}" TextElement.Foreground="{Binding Foreground, RelativeSource={RelativeSource FindAncestor, AncestorLevel=1, AncestorType={x:Type MenuBase}}}" TextElement.FontWeight="{Binding FontWeight, RelativeSource={RelativeSource FindAncestor, AncestorLevel=1, AncestorType={x:Type MenuBase}}}" TextElement.FontStyle="{Binding FontStyle, RelativeSource={RelativeSource FindAncestor, AncestorLevel=1, AncestorType={x:Type MenuBase}}}" TextElement.FontStretch="{Binding FontStretch, RelativeSource={RelativeSource FindAncestor, AncestorLevel=1, AncestorType={x:Type MenuBase}}}" TextElement.FontSize="{Binding FontSize, RelativeSource={RelativeSource FindAncestor, AncestorLevel=1, AncestorType={x:Type MenuBase}}}" TextElement.FontFamily="{Binding FontFamily, RelativeSource={RelativeSource FindAncestor, AncestorLevel=1, AncestorType={x:Type MenuBase}}}" SnapsToDevicePixels="{Binding SnapsToDevicePixels, RelativeSource={RelativeSource FindAncestor, AncestorLevel=1, AncestorType={x:Type MenuBase}}}" TextOptions.TextRenderingMode="{Binding (TextOptions.TextRenderingMode), RelativeSource={RelativeSource FindAncestor, AncestorLevel=1, AncestorType={x:Type MenuBase}}}" TextOptions.TextFormattingMode="{Binding (TextOptions.TextFormattingMode), RelativeSource={RelativeSource FindAncestor, AncestorLevel=1, AncestorType={x:Type MenuBase}}}">
                                                <StackPanel KeyboardNavigation.DirectionalNavigation="Cycle" HorizontalAlignment="Stretch" IsItemsHost="True" VerticalAlignment="Stretch"/>
                                            </Border>
                                        </Border>
                                    </Popup>
                                </Grid>
                            </Border>
                            <ControlTemplate.Triggers>
                                <Trigger Property="Icon" Value="{x:Null}">
                                    <Setter Property="Visibility" TargetName="IconHost" Value="Collapsed"/>
                                </Trigger>
                                <Trigger Property="IsSubmenuOpen" Value="True">
                                    <Setter Property="Fill" TargetName="ArrowGlyph" Value="#FF017BCD"/>
                                </Trigger>
                                <Trigger Property="IsSuspendingPopupAnimation" Value="True">
                                    <Setter Property="PopupAnimation" TargetName="PART_Popup" Value="None"/>
                                </Trigger>
                                <Trigger Property="Tag" SourceName="PART_Popup" Value="False">
                                    <Setter Property="PopupAnimation" TargetName="PART_Popup" Value="None"/>
                                </Trigger>
                                <DataTrigger Binding="{Binding Tag, ElementName=PopupRoot}" Value="True">
                                    <Setter Property="Effect" TargetName="PopupRoot">
                                        <Setter.Value>
                                            <DropShadowEffect BlurRadius="4" Color="{Binding (params:General.ShadowBrush).(SolidColorBrush.Color), RelativeSource={RelativeSource FindAncestor, AncestorLevel=1, AncestorType={x:Type MenuBase}}}" Direction="315" Opacity="0.3" ShadowDepth="2"/>
                                        </Setter.Value>
                                    </Setter>
                                    <Setter Property="Background" TargetName="PopupRoot" Value="Transparent"/>
                                    <Setter Property="Padding" TargetName="PopupRoot" Value="0,0,6,6"/>
                                </DataTrigger>
                            </ControlTemplate.Triggers>
                        </ControlTemplate>
                    </Setter.Value>
                </Setter>
            </Trigger>
            <Trigger Property="Role" Value="SubmenuItem">
                <Setter Property="Template">
                    <Setter.Value>
                        <ControlTemplate TargetType="{x:Type MenuItem}">
                            <Border BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}">
                                <Grid RenderOptions.ClearTypeHint="{TemplateBinding RenderOptions.ClearTypeHint}" TextElement.Foreground="{TemplateBinding Foreground}" TextElement.FontWeight="{TemplateBinding FontWeight}" TextElement.FontStyle="{TemplateBinding FontStyle}" TextElement.FontStretch="{TemplateBinding FontStretch}" TextElement.FontSize="{TemplateBinding FontSize}" TextElement.FontFamily="{TemplateBinding FontFamily}" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" Margin="{TemplateBinding Padding}" TextOptions.TextRenderingMode="{TemplateBinding TextOptions.TextRenderingMode}" TextOptions.TextFormattingMode="{TemplateBinding TextOptions.TextFormattingMode}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}">
                                    <Grid.ColumnDefinitions>
                                        <ColumnDefinition SharedSizeGroup="ContextMenuIconSizeGroup" Width="Auto"/>
                                        <ColumnDefinition Width="*"/>
                                        <ColumnDefinition SharedSizeGroup="ContextMenuShortcutSizeGroup" Width="Auto"/>
                                    </Grid.ColumnDefinitions>
                                    <Path x:Name="CheckBullet" Grid.Column="0" HorizontalAlignment="Center" Height="{TemplateBinding params:MenuItem.BulletSize}" Stretch="Uniform" Stroke="#FF4D4D4D" StrokeThickness="{TemplateBinding params:General.BoldThicknessValue}" Visibility="Collapsed" VerticalAlignment="Center" Width="{TemplateBinding params:MenuItem.BulletSize}">
                                        <Path.Data>
                                            <GeometryGroup>
                                                <LineGeometry EndPoint="4,8" StartPoint="0,3"/>
                                                <LineGeometry EndPoint="8,0" StartPoint="4,8"/>
                                            </GeometryGroup>
                                        </Path.Data>
                                    </Path>
                                    <ContentPresenter x:Name="IconHost" Content="{TemplateBinding Icon}" Grid.Column="0" ContentSource="Icon" HorizontalAlignment="Left" MinWidth="16" MinHeight="16" VerticalAlignment="Center"/>
                                    <ContentPresenter x:Name="HeaderHost" ContentTemplate="{TemplateBinding HeaderTemplate}" Content="{TemplateBinding Header}" Grid.Column="1" ContentStringFormat="{TemplateBinding HeaderStringFormat}" ContentSource="Header" HorizontalAlignment="Left" RecognizesAccessKey="True" VerticalAlignment="Center">
                                        <ContentPresenter.Margin>
                                            <Binding Converter="{StaticResource DoubleToThicknessConverter}" ConverterParameter="Left, Right" Mode="OneWay" Path="(params:General.BoldPaddingValue)" RelativeSource="{RelativeSource TemplatedParent}"/>
                                        </ContentPresenter.Margin>
                                    </ContentPresenter>
                                    <TextBlock Grid.Column="2" HorizontalAlignment="Left" Text="{TemplateBinding InputGestureText}" VerticalAlignment="Center">
                                        <TextBlock.Margin>
                                            <Binding Converter="{StaticResource DoubleToThicknessConverter}" ConverterParameter="Left, Right" Mode="OneWay" Path="(params:General.BoldPaddingValue)" RelativeSource="{RelativeSource TemplatedParent}"/>
                                        </TextBlock.Margin>
                                    </TextBlock>
                                </Grid>
                            </Border>
                            <ControlTemplate.Triggers>
                                <Trigger Property="Icon" Value="{x:Null}">
                                    <Setter Property="Visibility" TargetName="IconHost" Value="Collapsed"/>
                                </Trigger>
                                <Trigger Property="IsCheckable" Value="True">
                                    <Setter Property="Visibility" TargetName="IconHost" Value="Collapsed"/>
                                </Trigger>
                                <Trigger Property="IsChecked" Value="True">
                                    <Setter Property="Visibility" TargetName="CheckBullet" Value="Visible"/>
                                </Trigger>
                            </ControlTemplate.Triggers>
                        </ControlTemplate>
                    </Setter.Value>
                </Setter>
            </Trigger>
            <Trigger Property="IsHighlighted" Value="True">
                <Setter Property="Background" Value="#FFDEDEDE"/>
                <Setter Property="Foreground" Value="Black"/>
            </Trigger>
            <MultiTrigger>
                <MultiTrigger.Conditions>
                    <Condition Property="Role" Value="TopLevelHeader"/>
                    <Condition Property="IsHighlighted" Value="True"/>
                </MultiTrigger.Conditions>
                <Setter Property="Background" Value="#FFDEDEDE"/>
                <Setter Property="BorderBrush" Value="#FFDEDEDE"/>
            </MultiTrigger>
            <MultiTrigger>
                <MultiTrigger.Conditions>
                    <Condition Property="Role" Value="TopLevelItem"/>
                    <Condition Property="IsHighlighted" Value="True"/>
                </MultiTrigger.Conditions>
                <Setter Property="Background" Value="#FFDEDEDE"/>
                <Setter Property="BorderBrush" Value="#FFDEDEDE"/>
            </MultiTrigger>
            <Trigger Property="IsEnabled" Value="False">
                <Setter Property="Foreground" Value="#FFB8B5B2"/>
            </Trigger>
        </Style.Triggers>
    </Style>

    <Style x:Key="{x:Type Menu}" TargetType="{x:Type Menu}" >
        <Setter Property="Background" Value="{StaticResource BackgroundBrush}" />
        <Setter Property="BorderBrush" Value="{StaticResource LowlightBrush}" />
        <Setter Property="BorderThickness" Value="0" />
        <Setter Property="params:MenuBase.SubmenuBackground" Value="{StaticResource BackgroundBrush}" />
        <Setter Property="params:MenuBase.SubmenuBorderBrush" Value="{StaticResource LowlightBrush}" />
        <Setter Property="params:MenuBase.SubmenuBorderThickness" Value="{Binding RelativeSource={RelativeSource Self},Path=(params:General.DefaultThickness),Mode=OneWay}" />
        <Setter Property="Foreground" Value="{StaticResource ForegroundBrush}" />
        <Setter Property="FontSize" Value="{Binding RelativeSource={RelativeSource Self},Path=(params:General.ContentFontSize),Mode=OneWay}" />
        <Setter Property="FontStretch" Value="Medium" />
        <Setter Property="FontStyle" Value="Normal" />
        <Setter Property="FontWeight" Value="Normal" />
        <Setter Property="TextOptions.TextFormattingMode" Value="Display" />
        <Setter Property="TextOptions.TextRenderingMode" Value="ClearType" />
        <Setter Property="RenderOptions.ClearTypeHint" Value="Enabled" />
        <Setter Property="params:General.ShadowBrush" Value="{StaticResource ForegroundBrush}" />
        <Setter Property="HorizontalAlignment" Value="Stretch" />
        <Setter Property="VerticalAlignment" Value="Top" />
        <Setter Property="HorizontalContentAlignment" Value="Stretch" />
        <Setter Property="VerticalContentAlignment" Value="Stretch" />
        <Setter Property="Padding" Value="{Binding RelativeSource={RelativeSource Self},Path=(params:General.BoldPadding),Mode=OneWay}" />
        <Setter Property="SnapsToDevicePixels" Value="True" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type Menu}">
                    <Border Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" TextBlock.Foreground="{TemplateBinding Foreground}" TextBlock.FontFamily="{TemplateBinding Control.FontFamily}" TextBlock.FontSize="{TemplateBinding FontSize}" TextBlock.FontStretch="{TemplateBinding FontStretch}" TextBlock.FontStyle="{TemplateBinding FontStyle}" TextBlock.FontWeight="{TemplateBinding FontWeight}" TextOptions.TextFormattingMode="{TemplateBinding TextOptions.TextFormattingMode}" TextOptions.TextRenderingMode="{TemplateBinding TextOptions.TextRenderingMode}" RenderOptions.ClearTypeHint="{TemplateBinding RenderOptions.ClearTypeHint}" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}">
                        <ItemsPresenter Margin="{TemplateBinding Padding}" KeyboardNavigation.DirectionalNavigation="Cycle" />
                    </Border>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
        <Style.Triggers>
            <DataTrigger DataTrigger.Binding="{Binding RelativeSource={RelativeSource Self},Path=FontSize,Mode=OneWay,Converter={StaticResource IsGreaterThanConverter},ConverterParameter=18}">
                <Setter Property="TextOptions.TextFormattingMode" Value="Ideal" />
            </DataTrigger>
        </Style.Triggers>
    </Style>
    <Style x:Key="{x:Type controls:Submenu}" TargetType="{x:Type controls:Submenu}" >
        <Setter Property="Background" Value="{StaticResource BackgroundBrush}" />
        <Setter Property="BorderBrush" Value="{StaticResource LowlightBrush}" />
        <Setter Property="BorderThickness" Value="{Binding RelativeSource={RelativeSource Self},Path=(params:General.DefaultThickness),Mode=OneWay}" />
        <Setter Property="params:MenuBase.SubmenuBackground" Value="{Binding RelativeSource={RelativeSource Self},Path=Background,Mode=OneWay}" />
        <Setter Property="params:MenuBase.SubmenuBorderBrush" Value="{Binding RelativeSource={RelativeSource Self},Path=BorderBrush,Mode=OneWay}" />
        <Setter Property="params:MenuBase.SubmenuBorderThickness" Value="{Binding RelativeSource={RelativeSource Self},Path=BorderThickness,Mode=OneWay}" />
        <Setter Property="Foreground" Value="{StaticResource ForegroundBrush}" />
        <Setter Property="FontSize" Value="{Binding RelativeSource={RelativeSource Self},Path=(params:General.ContentFontSize),Mode=OneWay}" />
        <Setter Property="FontStretch" Value="Medium" />
        <Setter Property="FontStyle" Value="Normal" />
        <Setter Property="FontWeight" Value="Normal" />
        <Setter Property="TextOptions.TextFormattingMode" Value="Display" />
        <Setter Property="TextOptions.TextRenderingMode" Value="ClearType" />
        <Setter Property="RenderOptions.ClearTypeHint" Value="Enabled" />
        <Setter Property="params:General.ShadowBrush" Value="{StaticResource ForegroundBrush}" />
        <Setter Property="Grid.IsSharedSizeScope" Value="True" />
        <Setter Property="ScrollViewer.HorizontalScrollBarVisibility" Value="Auto" />
        <Setter Property="ScrollViewer.VerticalScrollBarVisibility" Value="Auto" />
        <Setter Property="ScrollViewer.PanningMode" Value="VerticalOnly" />
        <Setter Property="HorizontalContentAlignment" Value="Stretch" />
        <Setter Property="VerticalContentAlignment" Value="Stretch" />
        <Setter Property="Padding" Value="{Binding RelativeSource={RelativeSource Self},Path=(params:General.BoldPadding),Mode=OneWay}" />
        <Setter Property="SnapsToDevicePixels" Value="True" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type controls:Submenu}">
                    <Border x:Name="LayoutRoot" FrameworkElement.Tag="{DynamicResource {x:Static SystemParameters.DropShadowKey}}" Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" TextBlock.Foreground="{TemplateBinding Foreground}" TextBlock.FontSize="{TemplateBinding FontSize}" TextBlock.FontStretch="{TemplateBinding FontStretch}" TextBlock.FontStyle="{TemplateBinding FontStyle}" TextBlock.FontWeight="{TemplateBinding FontWeight}" TextOptions.TextFormattingMode="{TemplateBinding TextOptions.TextFormattingMode}" TextOptions.TextRenderingMode="{TemplateBinding TextOptions.TextRenderingMode}" RenderOptions.ClearTypeHint="{TemplateBinding RenderOptions.ClearTypeHint}" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}">
                        <ItemsPresenter KeyboardNavigation.DirectionalNavigation="Cycle" />
                    </Border>
                    <ControlTemplate.Triggers>
                        <DataTrigger Value="True" DataTrigger.Binding="{Binding ElementName=LayoutRoot,Path=Tag}">
                            <Setter TargetName="LayoutRoot" Property="UIElement.Effect">
                                <Setter.Value>
                                    <DropShadowEffect DropShadowEffect.BlurRadius="4" DropShadowEffect.ShadowDepth="2" DropShadowEffect.Direction="315" DropShadowEffect.Opacity="0.3" DropShadowEffect.Color="{Binding RelativeSource={RelativeSource AncestorType={x:Type controls:Submenu}},Path=(params:General.ShadowBrush).(SolidColorBrush.Color)}" />
                                </Setter.Value>
                            </Setter>
                            <Setter TargetName="LayoutRoot" Value="{StaticResource TransparentBrush}" Property="Border.Background" />
                            <Setter TargetName="LayoutRoot" Property="Border.Padding" Value="0,0,6,6" />
                        </DataTrigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
        <Style.Triggers>
            <DataTrigger DataTrigger.Binding="{Binding RelativeSource={RelativeSource Self},Path=FontSize,Mode=OneWay,Converter={StaticResource IsGreaterThanConverter},ConverterParameter=18}">
                <Setter Property="TextOptions.TextFormattingMode" Value="Ideal" />
            </DataTrigger>
        </Style.Triggers>
    </Style>

    <Style x:Key="{x:Type ContextMenu}" TargetType="{x:Type ContextMenu}" >
        <Setter Property="Background" Value="{StaticResource BackgroundBrush}" />
        <Setter Property="BorderBrush" Value="{StaticResource LowlightBrush}" />
        <Setter Property="BorderThickness" Value="{Binding RelativeSource={RelativeSource Self},Path=(params:General.DefaultThickness),Mode=OneWay}" />
        <Setter Property="params:MenuBase.SubmenuBackground" Value="{Binding RelativeSource={RelativeSource Self},Path=Background,Mode=OneWay}" />
        <Setter Property="params:MenuBase.SubmenuBorderBrush" Value="{Binding RelativeSource={RelativeSource Self},Path=BorderBrush,Mode=OneWay}" />
        <Setter Property="params:MenuBase.SubmenuBorderThickness" Value="{Binding RelativeSource={RelativeSource Self},Path=BorderThickness,Mode=OneWay}" />
        <Setter Property="Foreground" Value="{StaticResource ForegroundBrush}" />
        <Setter Property="FontSize" Value="{Binding RelativeSource={RelativeSource Self},Path=(params:General.ContentFontSize),Mode=OneWay}" />
        <Setter Property="FontStretch" Value="Medium" />
        <Setter Property="FontStyle" Value="Normal" />
        <Setter Property="FontWeight" Value="Normal" />
        <Setter Property="TextOptions.TextFormattingMode" Value="Display" />
        <Setter Property="TextOptions.TextRenderingMode" Value="ClearType" />
        <Setter Property="RenderOptions.ClearTypeHint" Value="Enabled" />
        <Setter Property="ContextMenu.HasDropShadow" Value="{DynamicResource {x:Static SystemParameters.DropShadowKey}}" />
        <Setter Property="params:General.ShadowBrush" Value="{StaticResource ForegroundBrush}" />
        <Setter Property="Focusable" Value="False" />
        <Setter Property="FocusVisualStyle" Value="{x:Null}" />
        <Setter Property="Grid.IsSharedSizeScope" Value="True" />
        <Setter Property="HorizontalContentAlignment" Value="Stretch" />
        <Setter Property="VerticalContentAlignment" Value="Stretch" />
        <Setter Property="Padding" Value="{Binding RelativeSource={RelativeSource Self},Path=(params:General.BoldPadding),Mode=OneWay}" />
        <Setter Property="SnapsToDevicePixels" Value="True" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type ContextMenu}">
                    <Border x:Name="LayoutRoot">
                        <Border Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" TextBlock.Foreground="{TemplateBinding Foreground}" TextBlock.FontFamily="{TemplateBinding Control.FontFamily}" TextBlock.FontSize="{TemplateBinding FontSize}" TextBlock.FontStretch="{TemplateBinding FontStretch}" TextBlock.FontStyle="{TemplateBinding FontStyle}" TextBlock.FontWeight="{TemplateBinding FontWeight}" TextOptions.TextFormattingMode="{TemplateBinding TextOptions.TextFormattingMode}" TextOptions.TextRenderingMode="{TemplateBinding TextOptions.TextRenderingMode}" RenderOptions.ClearTypeHint="{TemplateBinding RenderOptions.ClearTypeHint}" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}">
                            <ItemsPresenter KeyboardNavigation.DirectionalNavigation="Cycle" />
                        </Border>
                    </Border>
                    <ControlTemplate.Triggers>
                        <Trigger Property="ContextMenu.HasDropShadow" Value="True">
                            <Setter TargetName="LayoutRoot" Property="UIElement.Effect">
                                <Setter.Value>
                                    <DropShadowEffect DropShadowEffect.BlurRadius="4" DropShadowEffect.ShadowDepth="2" DropShadowEffect.Direction="315" DropShadowEffect.Opacity="0.3" DropShadowEffect.Color="{Binding RelativeSource={RelativeSource AncestorType={x:Type ContextMenu}},Path=(params:General.ShadowBrush).(SolidColorBrush.Color)}" />
                                </Setter.Value>
                            </Setter>
                            <Setter TargetName="LayoutRoot" Value="{StaticResource TransparentBrush}" Property="Border.Background" />
                            <Setter TargetName="LayoutRoot" Property="Border.Padding" Value="0,0,6,6" />
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
        <Style.Triggers>
            <DataTrigger DataTrigger.Binding="{Binding RelativeSource={RelativeSource Self},Path=FontSize,Mode=OneWay,Converter={StaticResource IsGreaterThanConverter},ConverterParameter=18}">
                <Setter Property="TextOptions.TextFormattingMode" Value="Ideal" />
            </DataTrigger>
        </Style.Triggers>
    </Style>








    <Style x:Key="TextBoxesBaseStyle" TargetType="{x:Type Control}" >
        <Setter Property="Background" Value="{StaticResource BackgroundBrush}" />
        <Setter Property="BorderBrush" Value="{StaticResource MiddleLightBrush}" />
        <Setter Property="BorderThickness" Value="{Binding RelativeSource={RelativeSource Self},Path=(params:General.SemiBoldThickness),Mode=OneWay}" />
        <Setter Property="Foreground" Value="{StaticResource ForegroundBrush}" />
        <Setter Property="FontSize" Value="{Binding RelativeSource={RelativeSource Self},Path=(params:General.TextFontSize),Mode=OneWay}" />
        <Setter Property="FontStretch" Value="Medium" />
        <Setter Property="FontStyle" Value="Normal" />
        <Setter Property="FontWeight" Value="Normal" />
        <Setter Property="TextOptions.TextFormattingMode" Value="Display" />
        <Setter Property="TextOptions.TextRenderingMode" Value="ClearType" />
        <Setter Property="RenderOptions.ClearTypeHint" Value="Enabled" />
        <Setter Property="FocusVisualStyle" Value="{x:Null}" />
        <Setter Property="ScrollViewer.PanningMode" Value="VerticalFirst" />
        <Setter Property="Stylus.IsFlicksEnabled" Value="False" />
        <Setter Property="HorizontalContentAlignment" Value="Left" />
        <Setter Property="VerticalContentAlignment" Value="Center" />
        <Setter Property="Padding" Value="{Binding RelativeSource={RelativeSource Self},Path=(params:General.DefaultPadding),Mode=OneWay}" />
        <Setter Property="FrameworkElement.ContextMenu">
            <Setter.Value>
                <ContextMenu FrameworkElement.Style="{StaticResource {x:Type ContextMenu}}">
                    <MenuItem HeaderedItemsControl.Header="Cut" MenuItem.Command="ApplicationCommands.Cut" />
                    <MenuItem HeaderedItemsControl.Header="Copy" MenuItem.Command="ApplicationCommands.Copy" />
                    <MenuItem HeaderedItemsControl.Header="Paste" MenuItem.Command="ApplicationCommands.Paste" />
                </ContextMenu>
            </Setter.Value>
        </Setter>
        <Setter Property="SnapsToDevicePixels" Value="True" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type Control}">
                    <Border Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}">
                        <ScrollViewer x:Name="PART_ContentHost" Background="{StaticResource TransparentBrush}" Foreground="{TemplateBinding Foreground}" FontSize="{TemplateBinding FontSize}" FontStretch="{TemplateBinding FontStretch}" FontStyle="{TemplateBinding FontStyle}" FontWeight="{TemplateBinding FontWeight}" TextOptions.TextFormattingMode="{TemplateBinding TextOptions.TextFormattingMode}" TextOptions.TextRenderingMode="{TemplateBinding TextOptions.TextRenderingMode}" RenderOptions.ClearTypeHint="{TemplateBinding RenderOptions.ClearTypeHint}" Margin="{TemplateBinding Padding}" />
                    </Border>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
        <Style.Triggers>
            <DataTrigger DataTrigger.Binding="{Binding RelativeSource={RelativeSource Self},Path=FontSize,Mode=OneWay,Converter={StaticResource IsGreaterThanConverter},ConverterParameter=18}">
                <Setter Property="TextOptions.TextFormattingMode" Value="Ideal" />
            </DataTrigger>
            <Trigger Property="IsMouseOver" Value="True">
                <Setter Property="BorderBrush" Value="{StaticResource AccentBrush}" />
                <Setter Property="Foreground" Value="{StaticResource ForegroundBrush}" />
            </Trigger>
            <Trigger Property="IsEnabled" Value="False">
                <Setter Property="BorderBrush" Value="{StaticResource DisabledBrush}" />
                <Setter Property="Foreground" Value="{StaticResource DisabledBrush}" />
            </Trigger>
        </Style.Triggers>
    </Style>

    <Style x:Key="TextBoxBaseStyle" TargetType="{x:Type TextBoxBase}" BasedOn="{StaticResource TextBoxesBaseStyle}" >
        <Setter Property="TextBoxBase.CaretBrush" Value="{StaticResource ForegroundBrush}" />
        <Setter Property="TextBoxBase.SelectionBrush" Value="{StaticResource MiddleLightBrush}" />
        <Style.Triggers>
            <MultiTrigger>
                <MultiTrigger.Conditions>
                    <Condition Property="UIElement.IsKeyboardFocusWithin" Value="True" />
                    <Condition Property="TextBoxBase.IsReadOnly" Value="False" />
                </MultiTrigger.Conditions>
                <MultiTrigger.Setters>
                    <Setter Property="BorderBrush" Value="{StaticResource AccentBrush}" />
                    <Setter Property="Foreground" Value="{StaticResource ForegroundBrush}" />
                </MultiTrigger.Setters>
            </MultiTrigger>
        </Style.Triggers>
    </Style>

    <Style x:Key="{x:Type TextBox}" TargetType="{x:Type TextBox}" BasedOn="{StaticResource TextBoxBaseStyle}"  />

    <Style x:Key="{x:Type RichTextBox}" TargetType="{x:Type RichTextBox}" BasedOn="{StaticResource TextBoxBaseStyle}" >
        <Style.Resources>
            <ResourceDictionary>
                <Style TargetType="{x:Type FlowDocument}">
                    <Setter Property="FrameworkContentElement.OverridesDefaultStyle" Value="True" />
                </Style>
            </ResourceDictionary>
        </Style.Resources>
    </Style>

    <Style x:Key="{x:Type PasswordBox}" TargetType="{x:Type PasswordBox}" BasedOn="{StaticResource TextBoxesBaseStyle}" >
        <Setter Property="PasswordBox.PasswordChar" Value="●" />
        <Setter Property="PasswordBox.CaretBrush" Value="{StaticResource ForegroundBrush}" />
        <Setter Property="PasswordBox.SelectionBrush" Value="{StaticResource MiddleLightBrush}" />
        <Style.Triggers>
            <Trigger Property="UIElement.IsKeyboardFocusWithin" Value="True">
                <Setter Property="BorderBrush" Value="{StaticResource AccentBrush}" />
                <Setter Property="Foreground" Value="{StaticResource ForegroundBrush}" />
            </Trigger>
        </Style.Triggers>
    </Style>

    <Style x:Key="SelectorsItemsBaseStyle" TargetType="{x:Type ListBoxItem}" >
        <Setter Property="Background" Value="{StaticResource TransparentBrush}" />
        <Setter Property="BorderBrush" Value="{StaticResource MiddleLightBrush}" />
        <Setter Property="BorderThickness" Value="0" />
        <Setter Property="Foreground" Value="{Binding RelativeSource={RelativeSource AncestorType={x:Type Selector}},Path=Foreground,Mode=OneWay}" />
        <Setter Property="Control.FontFamily" Value="{Binding RelativeSource={RelativeSource AncestorType={x:Type Selector}},Path=FontFamily,Mode=OneWay}" />
        <Setter Property="FontSize" Value="{Binding RelativeSource={RelativeSource AncestorType={x:Type Selector}},Path=FontSize,Mode=OneWay}" />
        <Setter Property="FontStretch" Value="{Binding RelativeSource={RelativeSource AncestorType={x:Type Selector}},Path=FontStretch,Mode=OneWay}" />
        <Setter Property="FontStyle" Value="{Binding RelativeSource={RelativeSource AncestorType={x:Type Selector}},Path=FontStyle,Mode=OneWay}" />
        <Setter Property="FontWeight" Value="{Binding RelativeSource={RelativeSource AncestorType={x:Type Selector}},Path=FontWeight,Mode=OneWay}" />
        <Setter Property="TextOptions.TextFormattingMode" Value="{Binding RelativeSource={RelativeSource AncestorType={x:Type Selector}},Path=(TextOptions.TextFormattingMode),Mode=OneWay}" />
        <Setter Property="TextOptions.TextRenderingMode" Value="{Binding RelativeSource={RelativeSource AncestorType={x:Type Selector}},Path=(TextOptions.TextRenderingMode),Mode=OneWay}" />
        <Setter Property="RenderOptions.ClearTypeHint" Value="{Binding RelativeSource={RelativeSource AncestorType={x:Type Selector}},Path=(RenderOptions.ClearTypeHint),Mode=OneWay}" />
        <Setter Property="Focusable" Value="True" />
        <Setter Property="FocusVisualStyle" Value="{StaticResource FocusVisualStyle}" />
        <Setter Property="HorizontalContentAlignment" Value="{Binding RelativeSource={RelativeSource AncestorType={x:Type Selector}},Path=HorizontalContentAlignment,Mode=OneWay}" />
        <Setter Property="VerticalContentAlignment" Value="{Binding RelativeSource={RelativeSource AncestorType={x:Type Selector}},Path=VerticalContentAlignment,Mode=OneWay}" />
        <Setter Property="Padding" Value="{Binding RelativeSource={RelativeSource AncestorType={x:Type Selector}},Path=Padding,Mode=OneWay}" />
        <Setter Property="SnapsToDevicePixels" Value="True" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type ListBoxItem}">
                    <Border Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" TextBlock.Foreground="{TemplateBinding Foreground}" TextBlock.FontSize="{TemplateBinding FontSize}" TextBlock.FontStretch="{TemplateBinding FontStretch}" TextBlock.FontStyle="{TemplateBinding FontStyle}" TextBlock.FontWeight="{TemplateBinding FontWeight}" TextOptions.TextFormattingMode="{TemplateBinding TextOptions.TextFormattingMode}" TextOptions.TextRenderingMode="{TemplateBinding TextOptions.TextRenderingMode}" RenderOptions.ClearTypeHint="{TemplateBinding RenderOptions.ClearTypeHint}" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}">
                        <ContentPresenter HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}" Margin="{TemplateBinding Padding}" />
                    </Border>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
        <Style.Triggers>
            <Trigger Property="IsEnabled" Value="False">
                <Setter Property="Foreground" Value="{StaticResource DisabledBrush}" />
            </Trigger>
        </Style.Triggers>
    </Style>

    <Style x:Key="{x:Type ListBoxItem}" TargetType="{x:Type ListBoxItem}" BasedOn="{StaticResource SelectorsItemsBaseStyle}" >
        <Style.Triggers>
            <MultiTrigger>
                <MultiTrigger.Conditions>
                    <Condition Property="IsEnabled" Value="True" />
                    <Condition Property="ListBoxItem.IsSelected" Value="True" />
                </MultiTrigger.Conditions>
                <MultiTrigger.Setters>
                    <Setter Property="Background" Value="{StaticResource AccentBrush}" />
                    <Setter Property="Foreground" Value="{StaticResource ContrastBrush}" />
                </MultiTrigger.Setters>
            </MultiTrigger>
            <MultiTrigger>
                <MultiTrigger.Conditions>
                    <Condition Property="IsEnabled" Value="False" />
                    <Condition Property="ListBoxItem.IsSelected" Value="True" />
                </MultiTrigger.Conditions>
                <MultiTrigger.Setters>
                    <Setter Property="Background" Value="{StaticResource DisabledBrush}" />
                    <Setter Property="Foreground" Value="{StaticResource ContrastBrush}" />
                </MultiTrigger.Setters>
            </MultiTrigger>
        </Style.Triggers>
    </Style>

    <Style x:Key="{x:Type ComboBoxItem}" TargetType="{x:Type ComboBoxItem}" BasedOn="{StaticResource SelectorsItemsBaseStyle}" >
        <Setter Property="Background" Value="{StaticResource BackgroundBrush}" />
        <Style.Triggers>
            <MultiTrigger>
                <MultiTrigger.Conditions>
                    <Condition Property="IsEnabled" Value="True" />
                    <Condition Property="ComboBoxItem.IsHighlighted" Value="True" />
                </MultiTrigger.Conditions>
                <Setter Property="Background" Value="{StaticResource AccentBrush}" />
                <Setter Property="Foreground" Value="{StaticResource ContrastBrush}" />
            </MultiTrigger>
            <MultiTrigger>
                <MultiTrigger.Conditions>
                    <Condition Property="IsEnabled" Value="False" />
                    <Condition Property="ComboBoxItem.IsHighlighted" Value="True" />
                </MultiTrigger.Conditions>
                <Setter Property="Background" Value="{StaticResource DisabledBrush}" />
                <Setter Property="Foreground" Value="{StaticResource ContrastBrush}" />
            </MultiTrigger>
        </Style.Triggers>
    </Style>

    <Style x:Key="{x:Type ListBox}" TargetType="{x:Type ListBox}" >
        <Setter Property="Background" Value="{StaticResource BackgroundBrush}" />
        <Setter Property="BorderBrush" Value="{StaticResource MiddleLightBrush}" />
        <Setter Property="BorderThickness" Value="0" />
        <Setter Property="Foreground" Value="{StaticResource ForegroundBrush}" />
        <Setter Property="FontSize" Value="{Binding RelativeSource={RelativeSource Self},Path=(params:General.ContentFontSize),Mode=OneWay}" />
        <Setter Property="FontStretch" Value="Medium" />
        <Setter Property="FontStyle" Value="Normal" />
        <Setter Property="FontWeight" Value="Normal" />
        <Setter Property="TextOptions.TextFormattingMode" Value="Display" />
        <Setter Property="TextOptions.TextRenderingMode" Value="ClearType" />
        <Setter Property="RenderOptions.ClearTypeHint" Value="Enabled" />
        <Setter Property="Focusable" Value="True" />
        <Setter Property="FocusVisualStyle" Value="{x:Null}" />
        <Setter Property="ScrollViewer.HorizontalScrollBarVisibility" Value="Auto" />
        <Setter Property="ScrollViewer.VerticalScrollBarVisibility" Value="Auto" />
        <Setter Property="ScrollViewer.CanContentScroll" Value="True" />
        <Setter Property="ScrollViewer.PanningMode" Value="Both" />
        <Setter Property="Stylus.IsFlicksEnabled" Value="False" />
        <Setter Property="HorizontalContentAlignment" Value="Left" />
        <Setter Property="VerticalContentAlignment" Value="Center" />
        <Setter Property="Padding" Value="{Binding RelativeSource={RelativeSource Self},Path=(params:General.BoldPadding),Mode=OneWay}" />
        <Setter Property="SnapsToDevicePixels" Value="True" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type ListBox}">
                    <Border Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}">
                        <ScrollViewer Foreground="{TemplateBinding Foreground}" FontSize="{TemplateBinding FontSize}" FontStretch="{TemplateBinding FontStretch}" FontStyle="{TemplateBinding FontStyle}" FontWeight="{TemplateBinding FontWeight}" TextOptions.TextFormattingMode="{TemplateBinding TextOptions.TextFormattingMode}" TextOptions.TextRenderingMode="{TemplateBinding TextOptions.TextRenderingMode}" RenderOptions.ClearTypeHint="{TemplateBinding RenderOptions.ClearTypeHint}" Focusable="False" Background="{x:Null}">
                            <ItemsPresenter />
                        </ScrollViewer>
                    </Border>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
        <Style.Triggers>
            <DataTrigger DataTrigger.Binding="{Binding RelativeSource={RelativeSource Self},Path=FontSize,Mode=OneWay,Converter={StaticResource IsGreaterThanConverter},ConverterParameter=18}">
                <Setter Property="TextOptions.TextFormattingMode" Value="Ideal" />
            </DataTrigger>
            <Trigger Property="IsEnabled" Value="False">
                <Setter Property="BorderBrush" Value="{StaticResource DisabledBrush}" />
                <Setter Property="Foreground" Value="{StaticResource DisabledBrush}" />
            </Trigger>
            <Trigger Property="ItemsControl.IsGrouping" Value="True">
                <Setter Property="ScrollViewer.CanContentScroll" Value="False" />
            </Trigger>
        </Style.Triggers>
    </Style>

    <Style x:Key="ComboBoxToggleButton" TargetType="{x:Type ToggleButton}" >
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type ToggleButton}">
                    <Border Background="{StaticResource TransparentBrush}" BorderBrush="{StaticResource TransparentBrush}" BorderThickness="0" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}">
                        <Polygon Name="ArrowGlyph" Fill="{StaticResource MiddleLightBrush}" StrokeThickness="0" Stretch="Uniform" HorizontalAlignment="Right" VerticalAlignment="Center" Margin="{Binding RelativeSource={RelativeSource AncestorType={x:Type ComboBox}},Path=(params:ComboBox.ArrowMargin),Mode=OneWay}" Width="{Binding RelativeSource={RelativeSource AncestorType={x:Type ComboBox}},Path=(params:ComboBox.ArrowSize),Mode=OneWay}" Height="{Binding RelativeSource={RelativeSource AncestorType={x:Type ComboBox}},Path=(params:ComboBox.ArrowSize),Mode=OneWay}">
                            <Polygon.Points>
                                <PointCollection>
                                    <Point Point.X="0" Point.Y="0" />
                                    <Point Point.X="3" Point.Y="4" />
                                    <Point Point.X="6" Point.Y="0" />
                                </PointCollection>
                            </Polygon.Points>
                        </Polygon>
                    </Border>
                    <ControlTemplate.Triggers>
                        <DataTrigger DataTrigger.Binding="{Binding RelativeSource={RelativeSource AncestorType={x:Type ComboBox}},Path=IsDropDownOpen,Mode=OneWay}">
                            <Setter TargetName="ArrowGlyph" Value="{StaticResource AccentBrush}" Property="Fill" />
                        </DataTrigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
    <Style x:Key="ComboBoxTextBox" TargetType="{x:Type TextBox}" >
        <Setter Property="TextOptions.TextFormattingMode" Value="Display" />
        <Setter Property="TextOptions.TextRenderingMode" Value="ClearType" />
        <Setter Property="RenderOptions.ClearTypeHint" Value="Enabled" />
        <Setter Property="TextBoxBase.CaretBrush" Value="{StaticResource ForegroundBrush}" />
        <Setter Property="TextBoxBase.SelectionBrush" Value="{StaticResource MiddleLightBrush}" />
        <Setter Property="FocusVisualStyle" Value="{x:Null}" />
        <Setter Property="ScrollViewer.PanningMode" Value="VerticalFirst" />
        <Setter Property="Stylus.IsFlicksEnabled" Value="False" />
        <Setter Property="SnapsToDevicePixels" Value="True" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type TextBox}">
                    <Border Background="{StaticResource TransparentBrush}" BorderBrush="{StaticResource TransparentBrush}" BorderThickness="0" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}">
                        <ScrollViewer x:Name="PART_ContentHost" Foreground="{TemplateBinding Foreground}" Control.FontFamily="{TemplateBinding Control.FontFamily}" FontSize="{TemplateBinding FontSize}" FontStretch="{TemplateBinding FontStretch}" FontStyle="{TemplateBinding FontStyle}" FontWeight="{TemplateBinding FontWeight}" TextOptions.TextFormattingMode="{TemplateBinding TextOptions.TextFormattingMode}" TextOptions.TextRenderingMode="{TemplateBinding TextOptions.TextRenderingMode}" RenderOptions.ClearTypeHint="{TemplateBinding RenderOptions.ClearTypeHint}" Margin="{TemplateBinding Padding}" Background="{x:Null}" />
                    </Border>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
        <Style.Triggers>
            <DataTrigger DataTrigger.Binding="{Binding RelativeSource={RelativeSource Self},Path=FontSize,Mode=OneWay,Converter={StaticResource IsGreaterThanConverter},ConverterParameter=18}">
                <Setter Property="TextOptions.TextFormattingMode" Value="Ideal" />
            </DataTrigger>
        </Style.Triggers>
    </Style>
    <Style x:Key="{x:Type ComboBox}" TargetType="{x:Type ComboBox}" >
        <Setter Property="Background" Value="{StaticResource BackgroundBrush}" />
        <Setter Property="BorderBrush" Value="{StaticResource MiddleLightBrush}" />
        <Setter Property="BorderThickness" Value="{Binding RelativeSource={RelativeSource Self},Path=(params:General.DefaultThickness),Mode=OneWay}" />
        <Setter Property="Foreground" Value="{StaticResource ForegroundBrush}" />
        <Setter Property="FontSize" Value="{Binding RelativeSource={RelativeSource Self},Path=(params:General.ContentFontSize),Mode=OneWay}" />
        <Setter Property="FontStretch" Value="Medium" />
        <Setter Property="FontStyle" Value="Normal" />
        <Setter Property="FontWeight" Value="Normal" />
        <Setter Property="TextOptions.TextFormattingMode" Value="Display" />
        <Setter Property="TextOptions.TextRenderingMode" Value="ClearType" />
        <Setter Property="RenderOptions.ClearTypeHint" Value="Enabled" />
        <Setter Property="params:General.ShadowBrush" Value="{StaticResource ForegroundBrush}" />
        <Setter Property="Focusable" Value="True" />
        <Setter Property="FocusVisualStyle" Value="{StaticResource FocusVisualStyle}" />
        <Setter Property="ScrollViewer.HorizontalScrollBarVisibility" Value="Auto" />
        <Setter Property="ScrollViewer.VerticalScrollBarVisibility" Value="Auto" />
        <Setter Property="ScrollViewer.CanContentScroll" Value="True" />
        <Setter Property="ScrollViewer.PanningMode" Value="Both" />
        <Setter Property="Stylus.IsFlicksEnabled" Value="False" />
        <Setter Property="HorizontalContentAlignment" Value="Left" />
        <Setter Property="VerticalContentAlignment" Value="Center" />
        <Setter Property="Padding" Value="{Binding RelativeSource={RelativeSource Self},Path=(params:General.BoldPadding),Mode=OneWay}" />
        <Setter Property="SnapsToDevicePixels" Value="True" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type ComboBox}">
                    <Decorator x:Name="LayoutRoot">
                        <Border Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}">
                            <Grid>
                                <Grid.ColumnDefinitions>
                                    <ColumnDefinition Width="*" />
                                    <ColumnDefinition Width="{Binding RelativeSource={RelativeSource TemplatedParent},Path=(params:ComboBox.ButtonSize),Converter={StaticResource DoubleToGridLengthConverter}}" />
                                </Grid.ColumnDefinitions>
                                <Popup x:Name="PART_Popup" Grid.Column="0" Grid.ColumnSpan="2" Popup.AllowsTransparency="True" Popup.Placement="Custom" Popup.CustomPopupPlacementCallback="{x:Static params:DropDown.PopupPlacementCallback}" Popup.PopupAnimation="{DynamicResource {x:Static SystemParameters.ComboBoxPopupAnimationKey}}" FrameworkElement.Tag="{DynamicResource {x:Static SystemParameters.ComboBoxAnimationKey}}" Popup.IsOpen="{Binding RelativeSource={RelativeSource TemplatedParent},Path=IsDropDownOpen,Mode=TwoWay}" Popup.PlacementTarget="{Binding ElementName=LayoutRoot}" Popup.VerticalOffset="{Binding RelativeSource={RelativeSource TemplatedParent},Path=BorderThickness,Converter={StaticResource ThicknessToDoubleConverter},ConverterParameter=Bottom}">
                                    <FrameworkElement.Resources>
                                        <ResourceDictionary>
                                            <Style TargetType="{x:Type ScrollBar}" BasedOn="{StaticResource {x:Type ScrollBar}}">
                                                <Style.Triggers>
                                                    <Trigger Property="ScrollBar.Orientation" Value="Vertical">
                                                        <Setter Property="BorderThickness" Value="0" />
                                                    </Trigger>
                                                </Style.Triggers>
                                            </Style>
                                        </ResourceDictionary>
                                    </FrameworkElement.Resources>
                                    <Border x:Name="PopupRoot" FrameworkElement.Tag="{DynamicResource {x:Static SystemParameters.DropShadowKey}}">
                                        <ScrollViewer x:Name="DropDownScrollViewer" Background="{StaticResource BackgroundBrush}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Foreground="{TemplateBinding Foreground}" FontSize="{TemplateBinding FontSize}" FontStretch="{TemplateBinding FontStretch}" FontStyle="{TemplateBinding FontStyle}" FontWeight="{TemplateBinding FontWeight}" TextOptions.TextFormattingMode="{TemplateBinding TextOptions.TextFormattingMode}" TextOptions.TextRenderingMode="{TemplateBinding TextOptions.TextRenderingMode}" RenderOptions.ClearTypeHint="{TemplateBinding RenderOptions.ClearTypeHint}" MaxHeight="{TemplateBinding ComboBox.MaxDropDownHeight}" MinWidth="{Binding ElementName=LayoutRoot,Path=ActualWidth}">
                                            <ItemsPresenter KeyboardNavigation.DirectionalNavigation="Contained" />
                                        </ScrollViewer>
                                    </Border>
                                </Popup>
                                <ToggleButton x:Name="Button" Grid.Column="0" Grid.ColumnSpan="2" FrameworkElement.Style="{StaticResource ComboBoxToggleButton}" IsChecked="{Binding RelativeSource={RelativeSource TemplatedParent},Path=IsDropDownOpen,Mode=TwoWay}" />
                                <ContentPresenter x:Name="ContentPresenter" Grid.Column="0" ContentPresenter.Content="{TemplateBinding ComboBox.SelectionBoxItem}" ContentPresenter.ContentStringFormat="{TemplateBinding ComboBox.SelectionBoxItemStringFormat}" ContentPresenter.ContentTemplate="{TemplateBinding ComboBox.SelectionBoxItemTemplate}" ContentPresenter.ContentTemplateSelector="{TemplateBinding ItemsControl.ItemTemplateSelector}" TextBlock.Foreground="{TemplateBinding Foreground}" TextBlock.FontSize="{TemplateBinding FontSize}" TextBlock.FontStretch="{TemplateBinding FontStretch}" TextBlock.FontStyle="{TemplateBinding FontStyle}" TextBlock.FontWeight="{TemplateBinding FontWeight}" TextOptions.TextFormattingMode="{TemplateBinding TextOptions.TextFormattingMode}" TextOptions.TextRenderingMode="{TemplateBinding TextOptions.TextRenderingMode}" RenderOptions.ClearTypeHint="{TemplateBinding RenderOptions.ClearTypeHint}" UIElement.IsHitTestVisible="False" Margin="{TemplateBinding Padding}" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}" Visibility="Visible" />
                                <Grid x:Name="TextBoxLayout" Grid.Column="0" Panel.Background="{StaticResource BackgroundBrush}" Visibility="Collapsed">
                                    <TextBox x:Name="PART_EditableTextBox" Foreground="{TemplateBinding Foreground}" Control.FontFamily="{TemplateBinding Control.FontFamily}" FontSize="{TemplateBinding FontSize}" FontStretch="{TemplateBinding FontStretch}" FontStyle="{TemplateBinding FontStyle}" FontWeight="{TemplateBinding FontWeight}" TextBoxBase.IsReadOnly="{TemplateBinding ComboBox.IsReadOnly}" Margin="{TemplateBinding Padding}" FrameworkElement.Style="{StaticResource ComboBoxTextBox}" />
                                </Grid>
                            </Grid>
                        </Border>
                    </Decorator>
                    <ControlTemplate.Triggers>
                        <Trigger Property="ComboBox.IsEditable" Value="True">
                            <Setter TargetName="Button" Property="Grid.Column" Value="1" />
                            <Setter TargetName="Button" Property="Grid.ColumnSpan" Value="1" />
                            <Setter TargetName="ContentPresenter" Property="Visibility" Value="Collapsed" />
                            <Setter TargetName="TextBoxLayout" Property="Visibility" Value="Visible" />
                        </Trigger>
                        <Trigger Trigger.SourceName="PART_Popup" Property="FrameworkElement.Tag" Value="False">
                            <Setter TargetName="PART_Popup" Property="Popup.PopupAnimation" Value="None" />
                        </Trigger>
                        <Trigger Property="ComboBox.IsDropDownOpen" Value="True">
                            <Setter TargetName="PART_Popup" Property="params:DropDown.IsOpen" Value="True" />
                        </Trigger>
                        <MultiTrigger>
                            <MultiTrigger.Conditions>
                                <Condition Condition.SourceName="PART_Popup" Property="params:DropDown.IsDefaultHorizontalPosition" Value="True" />
                                <Condition Condition.SourceName="PART_Popup" Property="params:DropDown.IsDefaultVerticalPosition" Value="True" />
                            </MultiTrigger.Conditions>
                            <MultiTrigger.Setters>
                                <Setter TargetName="DropDownScrollViewer" Value="{Binding RelativeSource={RelativeSource TemplatedParent},Path=BorderThickness,Mode=OneWay,Converter={StaticResource ThicknessConverter},ConverterParameter='Left, Right, Bottom'}" Property="BorderThickness" />
                            </MultiTrigger.Setters>
                        </MultiTrigger>
                        <MultiTrigger>
                            <MultiTrigger.Conditions>
                                <Condition Condition.SourceName="PART_Popup" Property="params:DropDown.IsDefaultHorizontalPosition" Value="True" />
                                <Condition Condition.SourceName="PART_Popup" Property="params:DropDown.IsDefaultVerticalPosition" Value="False" />
                            </MultiTrigger.Conditions>
                            <MultiTrigger.Setters>
                                <Setter TargetName="DropDownScrollViewer" Value="{Binding RelativeSource={RelativeSource TemplatedParent},Path=BorderThickness,Mode=OneWay,Converter={StaticResource ThicknessConverter},ConverterParameter='Left, Top, Right'}" Property="BorderThickness" />
                            </MultiTrigger.Setters>
                        </MultiTrigger>
                        <MultiDataTrigger>
                            <MultiDataTrigger.Conditions>
                                <Condition Condition.Binding="{Binding ElementName=PopupRoot,Path=Tag}" Value="True" />
                                <Condition Condition.Binding="{Binding ElementName=PART_Popup,Path=(params:DropDown.IsDefaultVerticalPosition)}" Value="True" />
                            </MultiDataTrigger.Conditions>
                            <MultiDataTrigger.Setters>
                                <Setter TargetName="PopupRoot" Property="UIElement.Effect">
                                    <Setter.Value>
                                        <DropShadowEffect DropShadowEffect.BlurRadius="4" DropShadowEffect.ShadowDepth="2" DropShadowEffect.Direction="315" DropShadowEffect.Opacity="0.3" DropShadowEffect.Color="{Binding RelativeSource={RelativeSource AncestorType={x:Type ComboBox}},Path=(params:General.ShadowBrush).(SolidColorBrush.Color)}" />
                                    </Setter.Value>
                                </Setter>
                                <Setter TargetName="PopupRoot" Value="{StaticResource TransparentBrush}" Property="Border.Background" />
                                <Setter TargetName="PopupRoot" Property="Border.Padding" Value="0,0,6,6" />
                            </MultiDataTrigger.Setters>
                        </MultiDataTrigger>
                        <MultiDataTrigger>
                            <MultiDataTrigger.Conditions>
                                <Condition Condition.Binding="{Binding ElementName=PopupRoot,Path=Tag}" Value="True" />
                                <Condition Condition.Binding="{Binding ElementName=PART_Popup,Path=(params:DropDown.IsDefaultVerticalPosition)}" Value="False" />
                            </MultiDataTrigger.Conditions>
                            <MultiDataTrigger.Setters>
                                <Setter TargetName="PopupRoot" Property="UIElement.Effect">
                                    <Setter.Value>
                                        <DropShadowEffect DropShadowEffect.BlurRadius="4" DropShadowEffect.ShadowDepth="0" DropShadowEffect.Direction="45" DropShadowEffect.Opacity="0.3" DropShadowEffect.Color="{Binding RelativeSource={RelativeSource AncestorType={x:Type ComboBox}},Path=(params:General.ShadowBrush).(SolidColorBrush.Color)}" />
                                    </Setter.Value>
                                </Setter>
                                <Setter TargetName="PopupRoot" Value="{StaticResource TransparentBrush}" Property="Border.Background" />
                                <Setter TargetName="PopupRoot" Property="Border.Padding" Value="0,4,4,0" />
                            </MultiDataTrigger.Setters>
                        </MultiDataTrigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
        <Style.Triggers>
            <DataTrigger DataTrigger.Binding="{Binding RelativeSource={RelativeSource Self},Path=FontSize,Mode=OneWay,Converter={StaticResource IsGreaterThanConverter},ConverterParameter=18}">
                <Setter Property="TextOptions.TextFormattingMode" Value="Ideal" />
            </DataTrigger>
            <Trigger Property="IsEnabled" Value="False">
                <Setter Property="BorderBrush" Value="{StaticResource DisabledBrush}" />
                <Setter Property="Foreground" Value="{StaticResource DisabledBrush}" />
            </Trigger>
            <Trigger Property="ItemsControl.IsGrouping" Value="True">
                <Setter Property="ScrollViewer.CanContentScroll" Value="False" />
            </Trigger>
            <Trigger Property="IsMouseOver" Value="True">
                <Setter Property="Background" Value="{StaticResource HighlightBrush}" />
            </Trigger>
            <Trigger Property="ComboBox.IsDropDownOpen" Value="True">
                <Setter Property="Background" Value="{StaticResource HighlightBrush}" />
            </Trigger>
        </Style.Triggers>
    </Style>

    <ControlTemplate x:Key="HorizontalProgressBarTemplate" TargetType="{x:Type controls:ProgressBar}" >
        <Border Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" UIElement.ClipToBounds="True" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}">
            <Canvas x:Name="PART_Track">
                <Rectangle x:Name="PART_Indicator" Fill="{TemplateBinding Foreground}" StrokeThickness="0" Canvas.Left="0" Canvas.Top="0" Width="{Binding ElementName=PART_Track,Path=ActualWidth}" Height="{Binding ElementName=PART_Track,Path=ActualHeight}">
                    <FrameworkElement.LayoutTransform>
                        <ScaleTransform ScaleTransform.ScaleX="{Binding RelativeSource={RelativeSource TemplatedParent},Path=Percent}" />
                    </FrameworkElement.LayoutTransform>
                </Rectangle>
                <Canvas x:Name="PART_BusyBar" Canvas.Left="0" Canvas.Top="0" Visibility="Hidden">
                    <Ellipse Fill="{TemplateBinding Foreground}" StrokeThickness="0" Width="{TemplateBinding params:Progress.BusyElementSize}" Height="{TemplateBinding params:Progress.BusyElementSize}" Canvas.Left="{Binding RelativeSource={RelativeSource TemplatedParent},Path=(params:Progress.BusyElementSize),Converter={StaticResource NumberPositiveToNegativeConverter}}" />
                    <Ellipse Fill="{TemplateBinding Foreground}" StrokeThickness="0" Width="{TemplateBinding params:Progress.BusyElementSize}" Height="{TemplateBinding params:Progress.BusyElementSize}" Canvas.Left="{Binding RelativeSource={RelativeSource TemplatedParent},Path=(params:Progress.BusyElementSize),Converter={StaticResource NumberPositiveToNegativeConverter}}" />
                    <Ellipse Fill="{TemplateBinding Foreground}" StrokeThickness="0" Width="{TemplateBinding params:Progress.BusyElementSize}" Height="{TemplateBinding params:Progress.BusyElementSize}" Canvas.Left="{Binding RelativeSource={RelativeSource TemplatedParent},Path=(params:Progress.BusyElementSize),Converter={StaticResource NumberPositiveToNegativeConverter}}" />
                    <Ellipse Fill="{TemplateBinding Foreground}" StrokeThickness="0" Width="{TemplateBinding params:Progress.BusyElementSize}" Height="{TemplateBinding params:Progress.BusyElementSize}" Canvas.Left="{Binding RelativeSource={RelativeSource TemplatedParent},Path=(params:Progress.BusyElementSize),Converter={StaticResource NumberPositiveToNegativeConverter}}" />
                    <Ellipse Fill="{TemplateBinding Foreground}" StrokeThickness="0" Width="{TemplateBinding params:Progress.BusyElementSize}" Height="{TemplateBinding params:Progress.BusyElementSize}" Canvas.Left="{Binding RelativeSource={RelativeSource TemplatedParent},Path=(params:Progress.BusyElementSize),Converter={StaticResource NumberPositiveToNegativeConverter}}" />
                </Canvas>
            </Canvas>
        </Border>
        <ControlTemplate.Triggers>
            <MultiTrigger>
                <MultiTrigger.Conditions>
                    <Condition Property="primitives:ProgressBase.State" Value="Indeterminate" />
                    <Condition Property="IsEnabled" Value="True" />
                </MultiTrigger.Conditions>
                <MultiTrigger.Setters>
                    <Setter TargetName="PART_Indicator" Value="{Binding ElementName=PART_Indicator,Path=ActualWidth,Converter={StaticResource NumberPositiveToNegativeConverter}}" Property="Canvas.Left" />
                    <Setter TargetName="PART_Indicator" Property="FrameworkElement.LayoutTransform">
                        <Setter.Value>
                            <ScaleTransform ScaleTransform.ScaleX="0.4" />
                        </Setter.Value>
                    </Setter>
                </MultiTrigger.Setters>
            </MultiTrigger>
            <MultiTrigger>
                <MultiTrigger.Conditions>
                    <Condition Property="primitives:ProgressBase.State" Value="Busy" />
                    <Condition Property="IsEnabled" Value="True" />
                </MultiTrigger.Conditions>
                <MultiTrigger.Setters>
                    <Setter TargetName="PART_Indicator" Property="Visibility" Value="Hidden" />
                    <Setter TargetName="PART_BusyBar" Property="Visibility" Value="Visible" />
                </MultiTrigger.Setters>
            </MultiTrigger>
        </ControlTemplate.Triggers>
    </ControlTemplate>
    <ControlTemplate x:Key="VerticalProgressBarTemplate" TargetType="{x:Type controls:ProgressBar}" >
        <Border Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" UIElement.ClipToBounds="True" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}">
            <Canvas x:Name="PART_Track" UIElement.RenderTransformOrigin="0.5,0.5">
                <UIElement.RenderTransform>
                    <ScaleTransform ScaleTransform.ScaleY="-1" />
                </UIElement.RenderTransform>
                <Rectangle x:Name="PART_Indicator" Fill="{TemplateBinding Foreground}" StrokeThickness="0" Canvas.Left="0" Canvas.Top="0" Width="{Binding ElementName=PART_Track,Path=ActualWidth}" Height="{Binding ElementName=PART_Track,Path=ActualHeight}">
                    <FrameworkElement.LayoutTransform>
                        <ScaleTransform ScaleTransform.ScaleY="{Binding RelativeSource={RelativeSource TemplatedParent},Path=Percent}" />
                    </FrameworkElement.LayoutTransform>
                </Rectangle>
                <Canvas x:Name="PART_BusyBar" Canvas.Left="0" Canvas.Top="0" Visibility="Hidden">
                    <Ellipse Fill="{TemplateBinding Foreground}" StrokeThickness="0" Width="{TemplateBinding params:Progress.BusyElementSize}" Height="{TemplateBinding params:Progress.BusyElementSize}" Canvas.Top="{Binding RelativeSource={RelativeSource TemplatedParent},Path=(params:Progress.BusyElementSize),Converter={StaticResource NumberPositiveToNegativeConverter}}" />
                    <Ellipse Fill="{TemplateBinding Foreground}" StrokeThickness="0" Width="{TemplateBinding params:Progress.BusyElementSize}" Height="{TemplateBinding params:Progress.BusyElementSize}" Canvas.Top="{Binding RelativeSource={RelativeSource TemplatedParent},Path=(params:Progress.BusyElementSize),Converter={StaticResource NumberPositiveToNegativeConverter}}" />
                    <Ellipse Fill="{TemplateBinding Foreground}" StrokeThickness="0" Width="{TemplateBinding params:Progress.BusyElementSize}" Height="{TemplateBinding params:Progress.BusyElementSize}" Canvas.Top="{Binding RelativeSource={RelativeSource TemplatedParent},Path=(params:Progress.BusyElementSize),Converter={StaticResource NumberPositiveToNegativeConverter}}" />
                    <Ellipse Fill="{TemplateBinding Foreground}" StrokeThickness="0" Width="{TemplateBinding params:Progress.BusyElementSize}" Height="{TemplateBinding params:Progress.BusyElementSize}" Canvas.Top="{Binding RelativeSource={RelativeSource TemplatedParent},Path=(params:Progress.BusyElementSize),Converter={StaticResource NumberPositiveToNegativeConverter}}" />
                    <Ellipse Fill="{TemplateBinding Foreground}" StrokeThickness="0" Width="{TemplateBinding params:Progress.BusyElementSize}" Height="{TemplateBinding params:Progress.BusyElementSize}" Canvas.Top="{Binding RelativeSource={RelativeSource TemplatedParent},Path=(params:Progress.BusyElementSize),Converter={StaticResource NumberPositiveToNegativeConverter}}" />
                </Canvas>
            </Canvas>
        </Border>
        <ControlTemplate.Triggers>
            <MultiTrigger>
                <MultiTrigger.Conditions>
                    <Condition Property="primitives:ProgressBase.State" Value="Indeterminate" />
                    <Condition Property="IsEnabled" Value="True" />
                </MultiTrigger.Conditions>
                <MultiTrigger.Setters>
                    <Setter TargetName="PART_Indicator" Value="{Binding ElementName=PART_Indicator,Path=ActualHeight,Converter={StaticResource NumberPositiveToNegativeConverter}}" Property="Canvas.Top" />
                    <Setter TargetName="PART_Indicator" Property="FrameworkElement.LayoutTransform">
                        <Setter.Value>
                            <ScaleTransform ScaleTransform.ScaleY="0.4" />
                        </Setter.Value>
                    </Setter>
                </MultiTrigger.Setters>
            </MultiTrigger>
            <MultiTrigger>
                <MultiTrigger.Conditions>
                    <Condition Property="primitives:ProgressBase.State" Value="Busy" />
                    <Condition Property="IsEnabled" Value="True" />
                </MultiTrigger.Conditions>
                <MultiTrigger.Setters>
                    <Setter TargetName="PART_Indicator" Property="Visibility" Value="Hidden" />
                    <Setter TargetName="PART_BusyBar" Property="Visibility" Value="Visible" />
                </MultiTrigger.Setters>
            </MultiTrigger>
        </ControlTemplate.Triggers>
    </ControlTemplate>
    <Style x:Key="{x:Type controls:ProgressBar}" TargetType="{x:Type controls:ProgressBar}" >
        <Setter Property="Background" Value="{StaticResource HighlightBrush}" />
        <Setter Property="BorderBrush" Value="{StaticResource MiddleLightBrush}" />
        <Setter Property="BorderThickness" Value="0" />
        <Setter Property="Foreground" Value="{StaticResource AccentBrush}" />
        <Setter Property="FocusVisualStyle" Value="{x:Null}" />
        <Setter Property="Focusable" Value="False" />
        <Setter Property="SnapsToDevicePixels" Value="True" />
        <Style.Triggers>
            <Trigger Property="primitives:ProgressBase.State" Value="Busy">
                <Setter Property="Background" Value="{x:Null}" />
            </Trigger>
            <Trigger Property="IsEnabled" Value="False">
                <Setter Property="Foreground" Value="{StaticResource DisabledBrush}" />
            </Trigger>
            <Trigger Property="controls:ProgressBar.Orientation" Value="Horizontal">
                <Setter Property="MinHeight" Value="2" />
                <Setter Property="Height" Value="4" />
                <Setter Property="MaxHeight" Value="8" />
                <Setter Property="MinWidth" Value="2" />
                <Setter Property="Template" Value="{StaticResource HorizontalProgressBarTemplate}" />
            </Trigger>
            <Trigger Property="controls:ProgressBar.Orientation" Value="Vertical">
                <Setter Property="MinHeight" Value="2" />
                <Setter Property="MinWidth" Value="2" />
                <Setter Property="Width" Value="4" />
                <Setter Property="MaxWidth" Value="8" />
                <Setter Property="Template" Value="{StaticResource VerticalProgressBarTemplate}" />
            </Trigger>
        </Style.Triggers>
    </Style>

    <Style x:Key="{x:Type controls:ProgressRing}" TargetType="{x:Type controls:ProgressRing}">
        <Setter Property="Background" Value="{StaticResource BackgroundBrush}" />
        <Setter Property="BorderBrush" Value="{StaticResource HighlightBrush}" />
        <Setter Property="BorderThickness" Value="3" />
        <Setter Property="Foreground" Value="{StaticResource AccentBrush}" />
        <Setter Property="FocusVisualStyle" Value="{x:Null}" />
        <Setter Property="Focusable" Value="False" />
        <Setter Property="MinWidth" Value="8px" />
        <Setter Property="MinHeight" Value="8px" />
        <Setter Property="SnapsToDevicePixels" Value="True" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type controls:ProgressRing}">
                    <Border UIElement.ClipToBounds="True" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}">
                        <Canvas x:Name="PART_Track" UIElement.RenderTransformOrigin="0.5,0.5">
                            <UIElement.RenderTransform>
                                <RotateTransform RotateTransform.Angle="90" />
                            </UIElement.RenderTransform>

                            <ed:Arc x:Name="BackgroundArc" Fill="{TemplateBinding Background}" Stroke="{TemplateBinding BorderBrush}" ed:Arc.StartAngle="0" ed:Arc.EndAngle="360" Stretch="None" UIElement.RenderTransformOrigin="0.5,0.5" Canvas.Left="0" Canvas.Top="0" StrokeThickness="{Binding BorderThickness,RelativeSource={RelativeSource TemplatedParent},Converter={StaticResource ThicknessToDoubleConverter}}" Width="{Binding ElementName=PART_Track,Path=ActualWidth}" Height="{Binding ElementName=PART_Track,Path=ActualHeight}">
                                <UIElement.RenderTransform>
                                    <RotateTransform RotateTransform.Angle="-90" />
                                </UIElement.RenderTransform>
                            </ed:Arc>
                            <ed:Arc x:Name="PART_Arc" Stroke="{TemplateBinding Foreground}" ed:Arc.StartAngle="0" Stretch="None" UIElement.RenderTransformOrigin="0.5,0.5" Canvas.Left="0" Canvas.Top="0" StrokeThickness="{Binding BorderThickness,RelativeSource={RelativeSource TemplatedParent},Converter={StaticResource ThicknessToDoubleConverter}}" ed:Arc.EndAngle="{Binding RelativeSource={RelativeSource TemplatedParent},Path=Percent,Converter={StaticResource PercentToAngleConverter}}" Width="{Binding ElementName=PART_Track,Path=ActualWidth}" Height="{Binding ElementName=PART_Track,Path=ActualHeight}">
                                <UIElement.RenderTransform>
                                    <RotateTransform RotateTransform.Angle="-90" />
                                </UIElement.RenderTransform>
                            </ed:Arc>
                            <Canvas x:Name="PART_BusyBar" Canvas.Left="0" Canvas.Top="0" Visibility="Hidden">
                                <Ellipse Fill="{TemplateBinding Foreground}" StrokeThickness="0" Width="{TemplateBinding params:Progress.BusyElementSize}" Height="{TemplateBinding params:Progress.BusyElementSize}">
                                    <Canvas.Left>
                                        <MultiBinding MultiBinding.Converter="{StaticResource AngleToCoordinateConverter}" MultiBinding.ConverterParameter="X">
                                            <Binding Binding.Path="(params:Progress.BusyElementSize)" Binding.Converter="{StaticResource NumberPositiveToNegativeConverter}" Binding.RelativeSource="{RelativeSource TemplatedParent}" />
                                            <Binding Binding.Path="(controls:ProgressRing.Angle)" Binding.RelativeSource="{RelativeSource Self}" />
                                            <Binding Binding.ElementName="PART_Track" Binding.Path="ActualWidth" />
                                            <Binding Binding.ElementName="PART_Track" Binding.Path="ActualHeight" />
                                            <Binding Binding.Path="(params:Progress.BusyElementSize)" Binding.RelativeSource="{RelativeSource TemplatedParent}" />
                                            <Binding Binding.Path="(params:Progress.BusyElementSize)" Binding.RelativeSource="{RelativeSource TemplatedParent}" />
                                        </MultiBinding>
                                    </Canvas.Left>
                                    <Canvas.Top>
                                        <MultiBinding MultiBinding.Converter="{StaticResource AngleToCoordinateConverter}" MultiBinding.ConverterParameter="Y">
                                            <Binding Binding.Path="(params:Progress.BusyElementSize)" Binding.Converter="{StaticResource NumberPositiveToNegativeConverter}" Binding.RelativeSource="{RelativeSource TemplatedParent}" />
                                            <Binding Binding.Path="(controls:ProgressRing.Angle)" Binding.RelativeSource="{RelativeSource Self}" />
                                            <Binding Binding.ElementName="PART_Track" Binding.Path="ActualWidth" />
                                            <Binding Binding.ElementName="PART_Track" Binding.Path="ActualHeight" />
                                            <Binding Binding.Path="(params:Progress.BusyElementSize)" Binding.RelativeSource="{RelativeSource TemplatedParent}" />
                                            <Binding Binding.Path="(params:Progress.BusyElementSize)" Binding.RelativeSource="{RelativeSource TemplatedParent}" />
                                        </MultiBinding>
                                    </Canvas.Top>
                                </Ellipse>
                                <Ellipse Fill="{TemplateBinding Foreground}" StrokeThickness="0" Width="{TemplateBinding params:Progress.BusyElementSize}" Height="{TemplateBinding params:Progress.BusyElementSize}">
                                    <Canvas.Left>
                                        <MultiBinding MultiBinding.Converter="{StaticResource AngleToCoordinateConverter}" MultiBinding.ConverterParameter="X">
                                            <Binding Binding.Path="(params:Progress.BusyElementSize)" Binding.Converter="{StaticResource NumberPositiveToNegativeConverter}" Binding.RelativeSource="{RelativeSource TemplatedParent}" />
                                            <Binding Binding.Path="(controls:ProgressRing.Angle)" Binding.RelativeSource="{RelativeSource Self}" />
                                            <Binding Binding.ElementName="PART_Track" Binding.Path="ActualWidth" />
                                            <Binding Binding.ElementName="PART_Track" Binding.Path="ActualHeight" />
                                            <Binding Binding.Path="(params:Progress.BusyElementSize)" Binding.RelativeSource="{RelativeSource TemplatedParent}" />
                                            <Binding Binding.Path="(params:Progress.BusyElementSize)" Binding.RelativeSource="{RelativeSource TemplatedParent}" />
                                        </MultiBinding>
                                    </Canvas.Left>
                                    <Canvas.Top>
                                        <MultiBinding MultiBinding.Converter="{StaticResource AngleToCoordinateConverter}" MultiBinding.ConverterParameter="Y">
                                            <Binding Binding.Path="(params:Progress.BusyElementSize)" Binding.Converter="{StaticResource NumberPositiveToNegativeConverter}" Binding.RelativeSource="{RelativeSource TemplatedParent}" />
                                            <Binding Binding.Path="(controls:ProgressRing.Angle)" Binding.RelativeSource="{RelativeSource Self}" />
                                            <Binding Binding.ElementName="PART_Track" Binding.Path="ActualWidth" />
                                            <Binding Binding.ElementName="PART_Track" Binding.Path="ActualHeight" />
                                            <Binding Binding.Path="(params:Progress.BusyElementSize)" Binding.RelativeSource="{RelativeSource TemplatedParent}" />
                                            <Binding Binding.Path="(params:Progress.BusyElementSize)" Binding.RelativeSource="{RelativeSource TemplatedParent}" />
                                        </MultiBinding>
                                    </Canvas.Top>
                                </Ellipse>
                                <Ellipse Fill="{TemplateBinding Foreground}" StrokeThickness="0" Width="{TemplateBinding params:Progress.BusyElementSize}" Height="{TemplateBinding params:Progress.BusyElementSize}">
                                    <Canvas.Left>
                                        <MultiBinding MultiBinding.Converter="{StaticResource AngleToCoordinateConverter}" MultiBinding.ConverterParameter="X">
                                            <Binding Binding.Path="(params:Progress.BusyElementSize)" Binding.Converter="{StaticResource NumberPositiveToNegativeConverter}" Binding.RelativeSource="{RelativeSource TemplatedParent}" />
                                            <Binding Binding.Path="(controls:ProgressRing.Angle)" Binding.RelativeSource="{RelativeSource Self}" />
                                            <Binding Binding.ElementName="PART_Track" Binding.Path="ActualWidth" />
                                            <Binding Binding.ElementName="PART_Track" Binding.Path="ActualHeight" />
                                            <Binding Binding.Path="(params:Progress.BusyElementSize)" Binding.RelativeSource="{RelativeSource TemplatedParent}" />
                                            <Binding Binding.Path="(params:Progress.BusyElementSize)" Binding.RelativeSource="{RelativeSource TemplatedParent}" />
                                        </MultiBinding>
                                    </Canvas.Left>
                                    <Canvas.Top>
                                        <MultiBinding MultiBinding.Converter="{StaticResource AngleToCoordinateConverter}" MultiBinding.ConverterParameter="Y">
                                            <Binding Binding.Path="(params:Progress.BusyElementSize)" Binding.Converter="{StaticResource NumberPositiveToNegativeConverter}" Binding.RelativeSource="{RelativeSource TemplatedParent}" />
                                            <Binding Binding.Path="(controls:ProgressRing.Angle)" Binding.RelativeSource="{RelativeSource Self}" />
                                            <Binding Binding.ElementName="PART_Track" Binding.Path="ActualWidth" />
                                            <Binding Binding.ElementName="PART_Track" Binding.Path="ActualHeight" />
                                            <Binding Binding.Path="(params:Progress.BusyElementSize)" Binding.RelativeSource="{RelativeSource TemplatedParent}" />
                                            <Binding Binding.Path="(params:Progress.BusyElementSize)" Binding.RelativeSource="{RelativeSource TemplatedParent}" />
                                        </MultiBinding>
                                    </Canvas.Top>
                                </Ellipse>
                                <Ellipse Fill="{TemplateBinding Foreground}" StrokeThickness="0" Width="{TemplateBinding params:Progress.BusyElementSize}" Height="{TemplateBinding params:Progress.BusyElementSize}">
                                    <Canvas.Left>
                                        <MultiBinding MultiBinding.Converter="{StaticResource AngleToCoordinateConverter}" MultiBinding.ConverterParameter="X">
                                            <Binding Binding.Path="(params:Progress.BusyElementSize)" Binding.Converter="{StaticResource NumberPositiveToNegativeConverter}" Binding.RelativeSource="{RelativeSource TemplatedParent}" />
                                            <Binding Binding.Path="(controls:ProgressRing.Angle)" Binding.RelativeSource="{RelativeSource Self}" />
                                            <Binding Binding.ElementName="PART_Track" Binding.Path="ActualWidth" />
                                            <Binding Binding.ElementName="PART_Track" Binding.Path="ActualHeight" />
                                            <Binding Binding.Path="(params:Progress.BusyElementSize)" Binding.RelativeSource="{RelativeSource TemplatedParent}" />
                                            <Binding Binding.Path="(params:Progress.BusyElementSize)" Binding.RelativeSource="{RelativeSource TemplatedParent}" />
                                        </MultiBinding>
                                    </Canvas.Left>
                                    <Canvas.Top>
                                        <MultiBinding MultiBinding.Converter="{StaticResource AngleToCoordinateConverter}" MultiBinding.ConverterParameter="Y">
                                            <Binding Binding.Path="(params:Progress.BusyElementSize)" Binding.Converter="{StaticResource NumberPositiveToNegativeConverter}" Binding.RelativeSource="{RelativeSource TemplatedParent}" />
                                            <Binding Binding.Path="(controls:ProgressRing.Angle)" Binding.RelativeSource="{RelativeSource Self}" />
                                            <Binding Binding.ElementName="PART_Track" Binding.Path="ActualWidth" />
                                            <Binding Binding.ElementName="PART_Track" Binding.Path="ActualHeight" />
                                            <Binding Binding.Path="(params:Progress.BusyElementSize)" Binding.RelativeSource="{RelativeSource TemplatedParent}" />
                                            <Binding Binding.Path="(params:Progress.BusyElementSize)" Binding.RelativeSource="{RelativeSource TemplatedParent}" />
                                        </MultiBinding>
                                    </Canvas.Top>
                                </Ellipse>
                                <Ellipse Fill="{TemplateBinding Foreground}" StrokeThickness="0" Width="{TemplateBinding params:Progress.BusyElementSize}" Height="{TemplateBinding params:Progress.BusyElementSize}">
                                    <Canvas.Left>
                                        <MultiBinding MultiBinding.Converter="{StaticResource AngleToCoordinateConverter}" MultiBinding.ConverterParameter="X">
                                            <Binding Binding.Path="(params:Progress.BusyElementSize)" Binding.Converter="{StaticResource NumberPositiveToNegativeConverter}" Binding.RelativeSource="{RelativeSource TemplatedParent}" />
                                            <Binding Binding.Path="(controls:ProgressRing.Angle)" Binding.RelativeSource="{RelativeSource Self}" />
                                            <Binding Binding.ElementName="PART_Track" Binding.Path="ActualWidth" />
                                            <Binding Binding.ElementName="PART_Track" Binding.Path="ActualHeight" />
                                            <Binding Binding.Path="(params:Progress.BusyElementSize)" Binding.RelativeSource="{RelativeSource TemplatedParent}" />
                                            <Binding Binding.Path="(params:Progress.BusyElementSize)" Binding.RelativeSource="{RelativeSource TemplatedParent}" />
                                        </MultiBinding>
                                    </Canvas.Left>
                                    <Canvas.Top>
                                        <MultiBinding MultiBinding.Converter="{StaticResource AngleToCoordinateConverter}" MultiBinding.ConverterParameter="Y">
                                            <Binding Binding.Path="(params:Progress.BusyElementSize)" Binding.Converter="{StaticResource NumberPositiveToNegativeConverter}" Binding.RelativeSource="{RelativeSource TemplatedParent}" />
                                            <Binding Binding.Path="(controls:ProgressRing.Angle)" Binding.RelativeSource="{RelativeSource Self}" />
                                            <Binding Binding.ElementName="PART_Track" Binding.Path="ActualWidth" />
                                            <Binding Binding.ElementName="PART_Track" Binding.Path="ActualHeight" />
                                            <Binding Binding.Path="(params:Progress.BusyElementSize)" Binding.RelativeSource="{RelativeSource TemplatedParent}" />
                                            <Binding Binding.Path="(params:Progress.BusyElementSize)" Binding.RelativeSource="{RelativeSource TemplatedParent}" />
                                        </MultiBinding>
                                    </Canvas.Top>
                                </Ellipse>
                            </Canvas>
                        </Canvas>
                    </Border>
                    <ControlTemplate.Triggers>
                        <MultiTrigger>
                            <MultiTrigger.Conditions>
                                <Condition Property="primitives:ProgressBase.State" Value="Busy" />
                                <Condition Property="IsEnabled" Value="True" />
                            </MultiTrigger.Conditions>
                            <MultiTrigger.Setters>
                                <Setter TargetName="BackgroundArc" Property="Visibility" Value="Hidden" />
                                <Setter TargetName="PART_Arc" Property="Visibility" Value="Hidden" />
                                <Setter TargetName="PART_BusyBar" Property="Visibility" Value="Visible" />
                            </MultiTrigger.Setters>
                        </MultiTrigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
        <Style.Triggers>
            <Trigger Property="primitives:ProgressBase.State" Value="Indeterminate">
                <Setter Property="BorderBrush" Value="{x:Null}" />
            </Trigger>
            <Trigger Property="primitives:ProgressBase.State" Value="Busy">
                <Setter Property="BorderBrush" Value="{x:Null}" />
            </Trigger>
            <Trigger Property="IsEnabled" Value="False">
                <Setter Property="Foreground" Value="{StaticResource DisabledBrush}" />
            </Trigger>
        </Style.Triggers>
    </Style>

    <Style x:Key="SliderRepeatButtonStyle" TargetType="{x:Type RepeatButton}" >
        <Setter Property="Background" Value="{StaticResource MiddleLightBrush}" />
        <Setter Property="FocusVisualStyle" Value="{x:Null}" />
        <Setter Property="Focusable" Value="False" />
        <Setter Property="Stylus.IsFlicksEnabled" Value="False" />
        <Setter Property="Stylus.IsPressAndHoldEnabled" Value="False" />
        <Setter Property="SnapsToDevicePixels" Value="True" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type RepeatButton}">
                    <Rectangle Fill="{TemplateBinding Background}" StrokeThickness="0" Width="{TemplateBinding Width}" Height="{TemplateBinding Height}" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
                </ControlTemplate>
            </Setter.Value>
        </Setter>
        <Style.Triggers>
            <Trigger Property="IsEnabled" Value="False">
                <Setter Property="Background" Value="{StaticResource HighlightBrush}" />
            </Trigger>
        </Style.Triggers>
    </Style>
    <Style x:Key="SliderRepeatButtonValuableStyle" TargetType="{x:Type RepeatButton}" BasedOn="{StaticResource SliderRepeatButtonStyle}" >
        <Setter Property="Background" Value="{StaticResource AccentBrush}" />
        <Style.Triggers>
            <Trigger Property="IsEnabled" Value="False">
                <Setter Property="Background" Value="{StaticResource DisabledBrush}" />
            </Trigger>
        </Style.Triggers>
    </Style>
    <Style x:Key="SliderThumbStyle" TargetType="{x:Type Thumb}" >
        <Setter Property="Background" Value="{StaticResource MiddleLightBrush}" />
        <Setter Property="BorderBrush" Value="{StaticResource BackgroundBrush}" />
        <Setter Property="FocusVisualStyle" Value="{x:Null}" />
        <Setter Property="Focusable" Value="False" />
        <Setter Property="Stylus.IsFlicksEnabled" Value="False" />
        <Setter Property="Stylus.IsPressAndHoldEnabled" Value="False" />
        <Setter Property="SnapsToDevicePixels" Value="True" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type Thumb}">
                    <Border Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Width="{TemplateBinding Width}" Height="{TemplateBinding Height}" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
                </ControlTemplate>
            </Setter.Value>
        </Setter>
        <Style.Triggers>
            <Trigger Property="IsMouseOver" Value="True">
                <Setter Property="Background" Value="{StaticResource LowlightBrush}" />
            </Trigger>
            <Trigger Property="Thumb.IsDragging" Value="True">
                <Setter Property="Background" Value="{StaticResource LowlightBrush}" />
            </Trigger>
            <Trigger Property="IsEnabled" Value="False">
                <Setter Property="Background" Value="{StaticResource DisabledBrush}" />
            </Trigger>
        </Style.Triggers>
    </Style>
    <ControlTemplate x:Key="HorizontalSliderTemplate" TargetType="{x:Type Slider}" >
        <Grid Panel.Background="{TemplateBinding Background}" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}">
            <Grid.RowDefinitions>
                <RowDefinition Height="Auto" />
                <RowDefinition Height="Auto" />
                <RowDefinition Height="Auto" />
            </Grid.RowDefinitions>
            <TickBar Grid.Row="0" TickBar.Fill="{TemplateBinding BorderBrush}" TickBar.Placement="Top" Height="{TemplateBinding params:Slider.TrackSize}" Visibility="Collapsed" />
            <Rectangle x:Name="PART_SelectionRange" Grid.Row="1" Fill="{StaticResource ForegroundBrush}" StrokeThickness="0" Height="{TemplateBinding params:Slider.TrackSize}" Visibility="Hidden" />
            <Track x:Name="PART_Track" Grid.Row="1" HorizontalAlignment="Stretch" VerticalAlignment="Stretch">
                <Track.DecreaseRepeatButton>
                    <RepeatButton ButtonBase.Command="{x:Static Slider.DecreaseLarge}" IsEnabled="{TemplateBinding IsEnabled}" Height="{TemplateBinding params:Slider.TrackSize}" FrameworkElement.Style="{StaticResource SliderRepeatButtonValuableStyle}" />
                </Track.DecreaseRepeatButton>
                <Track.Thumb>
                    <Thumb IsEnabled="{TemplateBinding IsEnabled}" Width="{TemplateBinding params:Slider.ThumbThickness}" FrameworkElement.Style="{StaticResource SliderThumbStyle}" BorderThickness="{Binding RelativeSource={RelativeSource Self},Path=(params:General.DefaultPaddingValue),Mode=OneWay,Converter={StaticResource DoubleToThicknessConverter},ConverterParameter=Right}" Height="{Binding RelativeSource={RelativeSource TemplatedParent},Path=ActualHeight,Mode=OneWay}" />
                </Track.Thumb>
                <Track.IncreaseRepeatButton>
                    <RepeatButton ButtonBase.Command="{x:Static Slider.IncreaseLarge}" IsEnabled="{TemplateBinding IsEnabled}" Height="{TemplateBinding params:Slider.TrackSize}" FrameworkElement.Style="{StaticResource SliderRepeatButtonStyle}" />
                </Track.IncreaseRepeatButton>
            </Track>
            <TickBar Grid.Row="2" TickBar.Fill="{TemplateBinding BorderBrush}" TickBar.Placement="Bottom" Height="{TemplateBinding params:Slider.TrackSize}" Visibility="Collapsed" />
        </Grid>
    </ControlTemplate>
    <ControlTemplate x:Key="VerticalSliderTemplate" TargetType="{x:Type Slider}" >
        <Grid Panel.Background="{TemplateBinding Background}" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}">
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="Auto" />
                <ColumnDefinition Width="Auto" />
                <ColumnDefinition Width="Auto" />
            </Grid.ColumnDefinitions>
            <TickBar Grid.Column="0" TickBar.Fill="{TemplateBinding BorderBrush}" TickBar.Placement="Top" Width="{TemplateBinding params:Slider.TrackSize}" Visibility="Collapsed" />
            <Rectangle x:Name="PART_SelectionRange" Grid.Column="1" Fill="{StaticResource ForegroundBrush}" StrokeThickness="0" Width="{TemplateBinding params:Slider.TrackSize}" Visibility="Hidden" />
            <Track x:Name="PART_Track" Grid.Column="1" HorizontalAlignment="Stretch" VerticalAlignment="Stretch">
                <Track.DecreaseRepeatButton>
                    <RepeatButton ButtonBase.Command="{x:Static Slider.DecreaseLarge}" IsEnabled="{TemplateBinding IsEnabled}" Width="{TemplateBinding params:Slider.TrackSize}" FrameworkElement.Style="{StaticResource SliderRepeatButtonValuableStyle}" />
                </Track.DecreaseRepeatButton>
                <Track.Thumb>
                    <Thumb IsEnabled="{TemplateBinding IsEnabled}" Height="{TemplateBinding params:Slider.ThumbThickness}" FrameworkElement.Style="{StaticResource SliderThumbStyle}" BorderThickness="{Binding RelativeSource={RelativeSource Self},Path=(params:General.DefaultPaddingValue),Mode=OneWay,Converter={StaticResource DoubleToThicknessConverter},ConverterParameter=Top}" Width="{Binding RelativeSource={RelativeSource TemplatedParent},Path=ActualWidth,Mode=OneWay}" />
                </Track.Thumb>
                <Track.IncreaseRepeatButton>
                    <RepeatButton ButtonBase.Command="{x:Static Slider.IncreaseLarge}" IsEnabled="{TemplateBinding IsEnabled}" Width="{TemplateBinding params:Slider.TrackSize}" FrameworkElement.Style="{StaticResource SliderRepeatButtonStyle}" />
                </Track.IncreaseRepeatButton>
            </Track>
            <TickBar Grid.Column="2" TickBar.Fill="{TemplateBinding BorderBrush}" TickBar.Placement="Bottom" Width="{TemplateBinding params:Slider.TrackSize}" Visibility="Collapsed" />
        </Grid>
    </ControlTemplate>
    <Style x:Key="{x:Type Slider}" TargetType="{x:Type Slider}" >
        <Setter Property="Background" Value="{x:Null}" />
        <Setter Property="BorderBrush" Value="{StaticResource MiddleLightBrush}" />
        <Setter Property="BorderThickness" Value="0" />
        <Setter Property="Foreground" Value="{StaticResource ForegroundBrush}" />
        <Setter Property="FontSize" Value="{Binding RelativeSource={RelativeSource Self},Path=(params:General.ContentFontSize),Mode=OneWay}" />
        <Setter Property="FontStretch" Value="Medium" />
        <Setter Property="FontStyle" Value="Normal" />
        <Setter Property="FontWeight" Value="Normal" />
        <Setter Property="FocusVisualStyle" Value="{x:Null}" />
        <Setter Property="Focusable" Value="False" />
        <Setter Property="Stylus.IsPressAndHoldEnabled" Value="False" />
        <Setter Property="SnapsToDevicePixels" Value="True" />
        <Style.Triggers>
            <Trigger Property="IsEnabled" Value="False">
                <Setter Property="BorderBrush" Value="{StaticResource DisabledBrush}" />
            </Trigger>
            <Trigger Property="Slider.Orientation" Value="Horizontal">
                <Setter Property="MinHeight" Value="14" />
                <Setter Property="Height" Value="18" />
                <Setter Property="MaxHeight" Value="22" />
                <Setter Property="Template" Value="{StaticResource HorizontalSliderTemplate}" />
            </Trigger>
            <Trigger Property="Slider.Orientation" Value="Vertical">
                <Setter Property="MinWidth" Value="14" />
                <Setter Property="Width" Value="18" />
                <Setter Property="MaxWidth" Value="22" />
                <Setter Property="Template" Value="{StaticResource VerticalSliderTemplate}" />
            </Trigger>
        </Style.Triggers>
    </Style>

    <Style x:Key="ToggleSwitchSwitchStyle" TargetType="{x:Type Button}" >
        <Setter Property="Background" Value="{StaticResource HighlightBrush}" />
        <Setter Property="FocusVisualStyle" Value="{x:Null}" />
        <Setter Property="Focusable" Value="False" />
        <Setter Property="Stylus.IsFlicksEnabled" Value="False" />
        <Setter Property="Stylus.IsPressAndHoldEnabled" Value="False" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type Button}">
                    <Rectangle Fill="{TemplateBinding Background}" StrokeThickness="0" />
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
    <Style x:Key="ToggleSwitchThumbStyle" TargetType="{x:Type Thumb}" >
        <Setter Property="Background" Value="{StaticResource MiddleLightBrush}" />
        <Setter Property="FocusVisualStyle" Value="{x:Null}" />
        <Setter Property="Focusable" Value="False" />
        <Setter Property="Stylus.IsFlicksEnabled" Value="False" />
        <Setter Property="Stylus.IsPressAndHoldEnabled" Value="False" />
        <Setter Property="SnapsToDevicePixels" Value="True" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type Thumb}">
                    <Border Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Width="{TemplateBinding Width}" Height="{TemplateBinding Height}" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
                </ControlTemplate>
            </Setter.Value>
        </Setter>
        <Style.Triggers>
            <Trigger Property="IsMouseOver" Value="True">
                <Setter Property="Background" Value="{StaticResource LowlightBrush}" />
            </Trigger>
            <Trigger Property="Thumb.IsDragging" Value="True">
                <Setter Property="Background" Value="{StaticResource LowlightBrush}" />
            </Trigger>
            <Trigger Property="IsEnabled" Value="False">
                <Setter Property="Background" Value="{StaticResource DisabledBrush}" />
            </Trigger>
        </Style.Triggers>
    </Style>
    <Style x:Key="{x:Type controls:ToggleSwitch}" TargetType="{x:Type controls:ToggleSwitch}" >
        <Setter Property="Background" Value="{StaticResource BackgroundBrush}" />
        <Setter Property="BorderBrush" Value="{StaticResource MiddleLightBrush}" />
        <Setter Property="BorderThickness" Value="{Binding RelativeSource={RelativeSource Self},Path=(params:General.DefaultThickness),Mode=OneWay}" />
        <Setter Property="Foreground" Value="{StaticResource ForegroundBrush}" />
        <Setter Property="FontSize" Value="{Binding RelativeSource={RelativeSource Self},Path=(params:General.ContentFontSize),Mode=OneWay}" />
        <Setter Property="FontStretch" Value="Medium" />
        <Setter Property="FontStyle" Value="Normal" />
        <Setter Property="FontWeight" Value="Normal" />
        <Setter Property="TextOptions.TextFormattingMode" Value="Display" />
        <Setter Property="TextOptions.TextRenderingMode" Value="ClearType" />
        <Setter Property="RenderOptions.ClearTypeHint" Value="Enabled" />
        <Setter Property="FocusVisualStyle" Value="{x:Null}" />
        <Setter Property="Focusable" Value="False" />
        <Setter Property="Stylus.IsPressAndHoldEnabled" Value="False" />
        <Setter Property="Padding" Value="0" />
        <Setter Property="MinHeight" Value="12" />
        <Setter Property="Height" Value="16" />
        <Setter Property="MaxHeight" Value="20" />
        <Setter Property="SnapsToDevicePixels" Value="True" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type controls:ToggleSwitch}">
                    <Grid TextBlock.Foreground="{TemplateBinding Foreground}" TextBlock.FontFamily="{TemplateBinding Control.FontFamily}" TextBlock.FontSize="{TemplateBinding FontSize}" TextBlock.FontStretch="{TemplateBinding FontStretch}" TextBlock.FontStyle="{TemplateBinding FontStyle}" TextBlock.FontWeight="{TemplateBinding FontWeight}" TextOptions.TextFormattingMode="{TemplateBinding TextOptions.TextFormattingMode}" TextOptions.TextRenderingMode="{TemplateBinding TextOptions.TextRenderingMode}" RenderOptions.ClearTypeHint="{TemplateBinding RenderOptions.ClearTypeHint}" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" Panel.Background="{x:Null}">
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="Auto" />
                            <ColumnDefinition Width="*" />
                            <ColumnDefinition Width="{Binding RelativeSource={RelativeSource TemplatedParent},Path=(params:ToggleSwitch.TrackSize),Mode=OneWay,Converter={StaticResource DoubleToGridLengthConverter}}" />
                        </Grid.ColumnDefinitions>
                        <ContentPresenter x:Name="OnHeaderHost" Grid.Column="0" ContentPresenter.Content="{TemplateBinding controls:ToggleSwitch.OnHeader}" ContentPresenter.ContentStringFormat="{TemplateBinding controls:ToggleSwitch.OnHeaderStringFormat}" ContentPresenter.ContentTemplate="{TemplateBinding controls:ToggleSwitch.OnHeaderTemplate}" ContentPresenter.ContentTemplateSelector="{TemplateBinding controls:ToggleSwitch.OnHeaderTemplateSelector}" HorizontalAlignment="Left" VerticalAlignment="Center" Visibility="Collapsed" />
                        <ContentPresenter x:Name="OffHeaderHost" Grid.Column="0" ContentPresenter.Content="{TemplateBinding controls:ToggleSwitch.OffHeader}" ContentPresenter.ContentStringFormat="{TemplateBinding controls:ToggleSwitch.OffHeaderStringFormat}" ContentPresenter.ContentTemplate="{TemplateBinding controls:ToggleSwitch.OffHeaderTemplate}" ContentPresenter.ContentTemplateSelector="{TemplateBinding controls:ToggleSwitch.OffHeaderTemplateSelector}" HorizontalAlignment="Left" VerticalAlignment="Center" Visibility="Collapsed" />
                        <Border x:Name="PART_Track" Grid.Column="2" Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}">
                            <DockPanel>
                                <Rectangle x:Name="PART_Fill" DockPanel.Dock="Left" Fill="{StaticResource AccentBrush}" Width="0" Margin="{Binding RelativeSource={RelativeSource TemplatedParent},Path=(params:General.DefaultThicknessValue),Mode=OneWay,Converter={StaticResource DoubleToThicknessConverter},ConverterParameter='Left, Top, Bottom'}" />
                                <Thumb x:Name="PART_Thumb" DockPanel.Dock="Left" BorderBrush="{TemplateBinding Background}" IsEnabled="{TemplateBinding IsEnabled}" Width="{TemplateBinding params:ToggleSwitch.ThumbThickness}" FrameworkElement.Style="{StaticResource ToggleSwitchThumbStyle}" BorderThickness="{Binding RelativeSource={RelativeSource TemplatedParent},Path=(params:General.DefaultThicknessValue),Mode=OneWay,Converter={StaticResource DoubleToThicknessConverter},ConverterParameter=Right}" Margin="{Binding RelativeSource={RelativeSource TemplatedParent},Path=BorderThickness,Mode=OneWay,Converter={StaticResource ThicknessPositiveToNegativeConverter}}" />
                                <Button x:Name="PART_Switch" FrameworkElement.Style="{StaticResource ToggleSwitchSwitchStyle}" Margin="{Binding RelativeSource={RelativeSource TemplatedParent},Path=(params:General.DefaultThicknessValue),Mode=OneWay,Converter={StaticResource DoubleToThicknessConverter},ConverterParameter='Right, Top, Bottom'}" />
                            </DockPanel>
                        </Border>
                    </Grid>
                    <ControlTemplate.Triggers>
                        <Trigger Property="controls:ToggleSwitch.IsChecked" Value="False">
                            <Setter TargetName="OffHeaderHost" Property="Visibility" Value="Visible" />
                        </Trigger>
                        <Trigger Property="controls:ToggleSwitch.IsChecked" Value="True">
                            <Setter TargetName="OnHeaderHost" Property="Visibility" Value="Visible" />
                            <Setter TargetName="PART_Fill" Property="DockPanel.Dock" Value="Right" />
                            <Setter TargetName="PART_Fill" Value="{StaticResource HighlightBrush}" Property="Fill" />
                            <Setter TargetName="PART_Fill" Value="{Binding RelativeSource={RelativeSource TemplatedParent},Path=(params:General.DefaultThicknessValue),Mode=OneWay,Converter={StaticResource DoubleToThicknessConverter},ConverterParameter='Right, Top, Bottom'}" Property="Margin" />
                            <Setter TargetName="PART_Thumb" Property="DockPanel.Dock" Value="Right" />
                            <Setter TargetName="PART_Thumb" Value="{Binding RelativeSource={RelativeSource TemplatedParent},Path=(params:General.DefaultThicknessValue),Mode=OneWay,Converter={StaticResource DoubleToThicknessConverter},ConverterParameter=Left}" Property="BorderThickness" />
                            <Setter TargetName="PART_Thumb" Value="{Binding RelativeSource={RelativeSource TemplatedParent},Path=BorderThickness,Mode=OneWay,Converter={StaticResource ThicknessPositiveToNegativeConverter}}" Property="Margin" />
                            <Setter TargetName="PART_Switch" Value="{Binding RelativeSource={RelativeSource TemplatedParent},Path=(params:General.DefaultThicknessValue),Mode=OneWay,Converter={StaticResource DoubleToThicknessConverter},ConverterParameter='Left, Top, Bottom'}" Property="Margin" />
                        </Trigger>
                        <MultiTrigger>
                            <MultiTrigger.Conditions>
                                <Condition Property="controls:ToggleSwitch.IsChecked" Value="True" />
                                <Condition Property="IsEnabled" Value="True" />
                            </MultiTrigger.Conditions>
                            <MultiTrigger.Setters>
                                <Setter TargetName="PART_Switch" Value="{StaticResource AccentBrush}" Property="Background" />
                            </MultiTrigger.Setters>
                        </MultiTrigger>
                        <MultiTrigger>
                            <MultiTrigger.Conditions>
                                <Condition Property="controls:ToggleSwitch.IsSwitching" Value="True" />
                                <Condition Property="controls:ToggleSwitch.IsChecked" Value="False" />
                            </MultiTrigger.Conditions>
                            <MultiTrigger.Setters>
                                <Setter TargetName="PART_Thumb" Value="{Binding RelativeSource={RelativeSource TemplatedParent},Path=(params:General.DefaultThicknessValue),Mode=OneWay,Converter={StaticResource DoubleToThicknessConverter},ConverterParameter=Left}" Property="BorderThickness" />
                            </MultiTrigger.Setters>
                        </MultiTrigger>
                        <MultiTrigger>
                            <MultiTrigger.Conditions>
                                <Condition Property="controls:ToggleSwitch.IsSwitching" Value="True" />
                                <Condition Property="controls:ToggleSwitch.IsChecked" Value="True" />
                            </MultiTrigger.Conditions>
                            <MultiTrigger.Setters>
                                <Setter TargetName="PART_Thumb" Value="{Binding RelativeSource={RelativeSource TemplatedParent},Path=(params:General.DefaultThicknessValue),Mode=OneWay,Converter={StaticResource DoubleToThicknessConverter},ConverterParameter=Right}" Property="BorderThickness" />
                            </MultiTrigger.Setters>
                        </MultiTrigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
        <Style.Triggers>
            <DataTrigger DataTrigger.Binding="{Binding RelativeSource={RelativeSource Self},Path=FontSize,Mode=OneWay,Converter={StaticResource IsGreaterThanConverter},ConverterParameter=18}">
                <Setter Property="TextOptions.TextFormattingMode" Value="Ideal" />
            </DataTrigger>
            <Trigger Property="IsEnabled" Value="False">
                <Setter Property="Background" Value="{StaticResource BackgroundBrush}" />
                <Setter Property="BorderBrush" Value="{StaticResource DisabledBrush}" />
                <Setter Property="Foreground" Value="{StaticResource DisabledBrush}" />
            </Trigger>
        </Style.Triggers>
    </Style>

    <Style x:Key="TabItemHeaderStyle" TargetType="{x:Type ContentControl}" >
        <Setter Property="Background" Value="{StaticResource TransparentBrush}" />
        <Setter Property="BorderBrush" Value="{StaticResource LowlightBrush}" />
        <Setter Property="BorderThickness" Value="0" />
        <Setter Property="Foreground" Value="{StaticResource LowlightBrush}" />
        <Setter Property="FontSize" Value="{Binding RelativeSource={RelativeSource Self},Path=(params:General.HeaderFontSize),Mode=OneWay}" />
        <Setter Property="FontStretch" Value="Medium" />
        <Setter Property="FontStyle" Value="Normal" />
        <Setter Property="FontWeight" Value="Normal" />
        <Setter Property="TextOptions.TextFormattingMode" Value="Display" />
        <Setter Property="TextOptions.TextRenderingMode" Value="ClearType" />
        <Setter Property="RenderOptions.ClearTypeHint" Value="Enabled" />
        <Setter Property="FocusVisualStyle" Value="{StaticResource FocusVisualStyle}" />
        <Setter Property="Focusable" Value="True" />
        <Setter Property="HorizontalContentAlignment" Value="Stretch" />
        <Setter Property="VerticalContentAlignment" Value="Stretch" />
        <Setter Property="Padding" Value="{Binding RelativeSource={RelativeSource Self},Path=(params:General.BoldPadding),Mode=OneWay}" />
        <Setter Property="SnapsToDevicePixels" Value="True" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type ContentControl}">
                    <Border Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}">
                        <Grid TextBlock.Foreground="{TemplateBinding Foreground}" TextBlock.FontFamily="{TemplateBinding Control.FontFamily}" TextBlock.FontSize="{TemplateBinding FontSize}" TextBlock.FontStretch="{TemplateBinding FontStretch}" TextBlock.FontStyle="{TemplateBinding FontStyle}" TextBlock.FontWeight="{TemplateBinding FontWeight}" TextOptions.TextFormattingMode="{TemplateBinding TextOptions.TextFormattingMode}" TextOptions.TextRenderingMode="{TemplateBinding TextOptions.TextRenderingMode}" RenderOptions.ClearTypeHint="{TemplateBinding RenderOptions.ClearTypeHint}" HorizontalAlignment="Stretch" VerticalAlignment="Stretch">
                            <Rectangle x:Name="Indicator" StrokeThickness="0" HorizontalAlignment="Stretch" VerticalAlignment="Bottom" Fill="{Binding RelativeSource={RelativeSource AncestorType={x:Type TabItem}},Path=(params:TabControl.IndicatorBrush)}" Height="{Binding RelativeSource={RelativeSource AncestorType={x:Type TabControl}},Path=(params:TabControl.IndicatorThickness)}" />
                            <ContentPresenter Margin="{TemplateBinding Padding}" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}" RecognizesAccessKey="True" />
                        </Grid>
                    </Border>
                    <ControlTemplate.Triggers>
                        <DataTrigger Value="{x:Static Dock.Bottom}" DataTrigger.Binding="{Binding RelativeSource={RelativeSource AncestorType={x:Type TabItem}},Path=TabStripPlacement}">
                            <Setter TargetName="Indicator" Property="VerticalAlignment" Value="Top" />
                        </DataTrigger>
                        <DataTrigger Value="{x:Static Dock.Left}" DataTrigger.Binding="{Binding RelativeSource={RelativeSource AncestorType={x:Type TabItem}},Path=TabStripPlacement}">
                            <Setter Property="FrameworkElement.LayoutTransform">
                                <Setter.Value>
                                    <RotateTransform RotateTransform.Angle="-90" />
                                </Setter.Value>
                            </Setter>
                            <Setter TargetName="Indicator" Property="VerticalAlignment" Value="Bottom" />
                        </DataTrigger>
                        <DataTrigger Value="{x:Static Dock.Right}" DataTrigger.Binding="{Binding RelativeSource={RelativeSource AncestorType={x:Type TabItem}},Path=TabStripPlacement}">
                            <Setter Property="FrameworkElement.LayoutTransform">
                                <Setter.Value>
                                    <RotateTransform RotateTransform.Angle="90" />
                                </Setter.Value>
                            </Setter>
                            <Setter TargetName="Indicator" Property="VerticalAlignment" Value="Bottom" />
                        </DataTrigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
        <Style.Triggers>
            <DataTrigger Value="{x:Static Dock.Left}" DataTrigger.Binding="{Binding RelativeSource={RelativeSource AncestorType={x:Type TabItem}},Path=TabStripPlacement}">
                <Setter Property="TextOptions.TextFormattingMode" Value="Ideal" />
            </DataTrigger>
            <DataTrigger Value="{x:Static Dock.Right}" DataTrigger.Binding="{Binding RelativeSource={RelativeSource AncestorType={x:Type TabItem}},Path=TabStripPlacement}">
                <Setter Property="TextOptions.TextFormattingMode" Value="Ideal" />
            </DataTrigger>
            <DataTrigger DataTrigger.Binding="{Binding RelativeSource={RelativeSource Self},Path=FontSize,Mode=OneWay,Converter={StaticResource IsGreaterThanConverter},ConverterParameter=18}">
                <Setter Property="TextOptions.TextFormattingMode" Value="Ideal" />
            </DataTrigger>
            <Trigger Property="IsMouseOver" Value="True">
                <Setter Property="Foreground" Value="{StaticResource ForegroundBrush}" />
            </Trigger>
            <DataTrigger DataTrigger.Binding="{Binding RelativeSource={RelativeSource AncestorType={x:Type TabItem}},Path=IsSelected}" Value="True">
                <Setter Property="BorderBrush" Value="{StaticResource AccentBrush}" />
                <Setter Property="Foreground" Value="{StaticResource ForegroundBrush}" />
            </DataTrigger>
            <Trigger Property="IsEnabled" Value="False">
                <Setter Property="BorderBrush" Value="{StaticResource DisabledBrush}" />
                <Setter Property="Foreground" Value="{StaticResource DisabledBrush}" />
            </Trigger>
        </Style.Triggers>
    </Style>
    <Style x:Key="{x:Type TabItem}" TargetType="{x:Type TabItem}" >
        <Setter Property="Background" Value="{Binding RelativeSource={RelativeSource AncestorType={x:Type TabControl}},Path=Background,Mode=OneWay}" />
        <Setter Property="BorderBrush" Value="{Binding RelativeSource={RelativeSource AncestorType={x:Type TabControl}},Path=BorderBrush,Mode=OneWay}" />
        <Setter Property="BorderThickness" Value="{Binding RelativeSource={RelativeSource AncestorType={x:Type TabControl}},Path=BorderThickness,Mode=OneWay}" />
        <Setter Property="Foreground" Value="{Binding RelativeSource={RelativeSource AncestorType={x:Type TabControl}},Path=Foreground,Mode=OneWay}" />
        <Setter Property="FontSize" Value="{Binding RelativeSource={RelativeSource AncestorType={x:Type TabControl}},Path=FontSize,Mode=OneWay}" />
        <Setter Property="FontStretch" Value="{Binding RelativeSource={RelativeSource AncestorType={x:Type TabControl}},Path=FontStretch,Mode=OneWay}" />
        <Setter Property="FontStyle" Value="{Binding RelativeSource={RelativeSource AncestorType={x:Type TabControl}},Path=FontStyle,Mode=OneWay}" />
        <Setter Property="FontWeight" Value="{Binding RelativeSource={RelativeSource AncestorType={x:Type TabControl}},Path=FontWeight,Mode=OneWay}" />
        <Setter Property="TextOptions.TextFormattingMode" Value="{Binding RelativeSource={RelativeSource AncestorType={x:Type TabControl}},Path=(TextOptions.TextFormattingMode),Mode=OneWay}" />
        <Setter Property="TextOptions.TextRenderingMode" Value="{Binding RelativeSource={RelativeSource AncestorType={x:Type TabControl}},Path=(TextOptions.TextRenderingMode),Mode=OneWay}" />
        <Setter Property="RenderOptions.ClearTypeHint" Value="{Binding RelativeSource={RelativeSource AncestorType={x:Type TabControl}},Path=(RenderOptions.ClearTypeHint),Mode=OneWay}" />
        <Setter Property="FocusVisualStyle" Value="{StaticResource FocusVisualStyle}" />
        <Setter Property="Focusable" Value="True" />
        <Setter Property="HorizontalContentAlignment" Value="Stretch" />
        <Setter Property="VerticalContentAlignment" Value="Stretch" />
        <Setter Property="Padding" Value="{Binding RelativeSource={RelativeSource AncestorType={x:Type TabControl}},Path=Padding,Mode=OneWay}" />
        <Setter Property="params:TabItem.HeaderStyle" Value="{StaticResource TabItemHeaderStyle}" />
        <Setter Property="params:TabControl.IndicatorBrush" Value="{Binding RelativeSource={RelativeSource AncestorType={x:Type TabControl}},Path=(params:TabControl.IndicatorBrush)}" />
        <Setter Property="SnapsToDevicePixels" Value="True" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type TabItem}">
                    <ContentControl x:Name="ContentHost" ContentControl.Content="{TemplateBinding HeaderedContentControl.Header}" TextOptions.TextFormattingMode="{TemplateBinding TextOptions.TextFormattingMode}" TextOptions.TextRenderingMode="{TemplateBinding TextOptions.TextRenderingMode}" RenderOptions.ClearTypeHint="{TemplateBinding RenderOptions.ClearTypeHint}" FrameworkElement.Style="{TemplateBinding params:TabItem.HeaderStyle}" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
                </ControlTemplate>
            </Setter.Value>
        </Setter>
        <Style.Triggers>
            <DataTrigger DataTrigger.Binding="{Binding RelativeSource={RelativeSource Self},Path=FontSize,Mode=OneWay,Converter={StaticResource IsGreaterThanConverter},ConverterParameter=18}">
                <Setter Property="TextOptions.TextFormattingMode" Value="Ideal" />
            </DataTrigger>
            <Trigger Property="TabItem.IsSelected" Value="True">
                <Setter Property="params:TabControl.IndicatorBrush" Value="{StaticResource AccentBrush}" />
            </Trigger>
        </Style.Triggers>
    </Style>

    <Style x:Key="{x:Type TabControl}" TargetType="{x:Type TabControl}" >
        <Setter Property="Background" Value="{StaticResource BackgroundBrush}" />
        <Setter Property="BorderBrush" Value="{StaticResource LowlightBrush}" />
        <Setter Property="BorderThickness" Value="0" />
        <Setter Property="params:TabControl.IndicatorBrush" Value="{StaticResource HighlightBrush}" />
        <Setter Property="Foreground" Value="{StaticResource ForegroundBrush}" />
        <Setter Property="FontSize" Value="{Binding RelativeSource={RelativeSource Self},Path=(params:General.TextFontSize),Mode=OneWay}" />
        <Setter Property="FontStretch" Value="Medium" />
        <Setter Property="FontStyle" Value="Normal" />
        <Setter Property="FontWeight" Value="Normal" />
        <Setter Property="TextOptions.TextFormattingMode" Value="Display" />
        <Setter Property="TextOptions.TextRenderingMode" Value="ClearType" />
        <Setter Property="RenderOptions.ClearTypeHint" Value="Enabled" />
        <Setter Property="UIElement.ClipToBounds" Value="True" />
        <Setter Property="FocusVisualStyle" Value="{x:Null}" />
        <Setter Property="Focusable" Value="False" />
        <Setter Property="HorizontalContentAlignment" Value="Stretch" />
        <Setter Property="VerticalContentAlignment" Value="Stretch" />
        <Setter Property="Padding" Value="{Binding RelativeSource={RelativeSource Self},Path=(params:General.BoldPadding),Converter={StaticResource ThicknessConverter},ConverterParameter=Top,Mode=OneWay}" />
        <Setter Property="SnapsToDevicePixels" Value="True" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type TabControl}">
                    <Border Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" TextBlock.Foreground="{TemplateBinding Foreground}" TextBlock.FontFamily="{TemplateBinding Control.FontFamily}" TextBlock.FontSize="{TemplateBinding FontSize}" TextBlock.FontStretch="{TemplateBinding FontStretch}" TextBlock.FontStyle="{TemplateBinding FontStyle}" TextBlock.FontWeight="{TemplateBinding FontWeight}" TextOptions.TextFormattingMode="{TemplateBinding TextOptions.TextFormattingMode}" TextOptions.TextRenderingMode="{TemplateBinding TextOptions.TextRenderingMode}" RenderOptions.ClearTypeHint="{TemplateBinding RenderOptions.ClearTypeHint}" KeyboardNavigation.DirectionalNavigation="Local" UIElement.ClipToBounds="{TemplateBinding UIElement.ClipToBounds}" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}">
                        <Grid>
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition x:Name="FirstColumnDefinition" Width="*" />
                                <ColumnDefinition x:Name="SecondColumnDefinition" Width="0" />
                            </Grid.ColumnDefinitions>
                            <Grid.RowDefinitions>
                                <RowDefinition x:Name="FirstRowDefinition" Height="Auto" />
                                <RowDefinition x:Name="SecondRowDefinition" Height="*" />
                            </Grid.RowDefinitions>
                            <Rectangle x:Name="Indicator" Grid.Column="0" Grid.Row="0" Fill="{TemplateBinding params:TabControl.IndicatorBrush}" Height="{TemplateBinding params:TabControl.IndicatorThickness}" HorizontalAlignment="Stretch" VerticalAlignment="Bottom" />
                            <TabPanel x:Name="HeaderPanel" Grid.Column="0" Grid.Row="0" Panel.IsItemsHost="True" KeyboardNavigation.TabIndex="1" />
                            <Border x:Name="ContentPanel" Grid.Column="0" Grid.Row="1" KeyboardNavigation.DirectionalNavigation="Contained" KeyboardNavigation.TabIndex="2" KeyboardNavigation.TabNavigation="Local" Background="{Binding RelativeSource={RelativeSource TemplatedParent},Path=SelectedItem.(TabItem.Background)}" BorderBrush="{Binding RelativeSource={RelativeSource TemplatedParent},Path=SelectedItem.(TabItem.BorderBrush)}" BorderThickness="{Binding RelativeSource={RelativeSource TemplatedParent},Path=SelectedItem.(TabItem.BorderThickness)}" TextBlock.Foreground="{Binding RelativeSource={RelativeSource TemplatedParent},Path=SelectedItem.(TabItem.Foreground)}" TextBlock.FontFamily="{Binding RelativeSource={RelativeSource TemplatedParent},Path=SelectedItem.(TabItem.FontFamily)}" TextBlock.FontSize="{Binding RelativeSource={RelativeSource TemplatedParent},Path=SelectedItem.(TabItem.FontSize)}" TextBlock.FontStretch="{Binding RelativeSource={RelativeSource TemplatedParent},Path=SelectedItem.(TabItem.FontStretch)}" TextBlock.FontStyle="{Binding RelativeSource={RelativeSource TemplatedParent},Path=SelectedItem.(TabItem.FontStyle)}" TextBlock.FontWeight="{Binding RelativeSource={RelativeSource TemplatedParent},Path=SelectedItem.(TabItem.FontWeight)}" TextOptions.TextFormattingMode="{Binding RelativeSource={RelativeSource TemplatedParent},Path=SelectedItem.(TextOptions.TextFormattingMode)}" TextOptions.TextRenderingMode="{Binding RelativeSource={RelativeSource TemplatedParent},Path=SelectedItem.(TextOptions.TextRenderingMode)}" RenderOptions.ClearTypeHint="{Binding RelativeSource={RelativeSource TemplatedParent},Path=SelectedItem.(RenderOptions.ClearTypeHint)}">
                                <ContentPresenter x:Name="PART_SelectedContentHost" ContentPresenter.ContentSource="SelectedContent" Margin="{Binding RelativeSource={RelativeSource TemplatedParent},Path=SelectedItem.(TabItem.Padding)}" HorizontalAlignment="{Binding RelativeSource={RelativeSource TemplatedParent},Path=SelectedItem.(TabItem.HorizontalContentAlignment),Mode=OneWay,UpdateSourceTrigger=PropertyChanged}" VerticalAlignment="{Binding RelativeSource={RelativeSource TemplatedParent},Path=SelectedItem.(TabItem.VerticalContentAlignment),Mode=OneWay,UpdateSourceTrigger=PropertyChanged}" />
                            </Border>
                        </Grid>
                    </Border>
                    <ControlTemplate.Triggers>
                        <Trigger Property="TabControl.TabStripPlacement" Value="Bottom">
                            <Setter TargetName="FirstRowDefinition" Property="Height" Value="*" />
                            <Setter TargetName="SecondRowDefinition" Property="Height" Value="Auto" />
                            <Setter TargetName="Indicator" Property="Grid.Row" Value="1" />
                            <Setter TargetName="HeaderPanel" Property="Grid.Row" Value="1" />
                            <Setter TargetName="ContentPanel" Property="Grid.Row" Value="0" />
                            <Setter TargetName="Indicator" Property="VerticalAlignment" Value="Top" />
                        </Trigger>
                        <Trigger Property="TabControl.TabStripPlacement" Value="Left">
                            <Setter TargetName="FirstColumnDefinition" Property="Width" Value="Auto" />
                            <Setter TargetName="SecondColumnDefinition" Property="Width" Value="*" />
                            <Setter TargetName="FirstRowDefinition" Property="Height" Value="*" />
                            <Setter TargetName="SecondRowDefinition" Property="Height" Value="0" />
                            <Setter TargetName="Indicator" Property="Grid.Column" Value="0" />
                            <Setter TargetName="HeaderPanel" Property="Grid.Column" Value="0" />
                            <Setter TargetName="ContentPanel" Property="Grid.Column" Value="1" />
                            <Setter TargetName="Indicator" Property="Grid.Row" Value="0" />
                            <Setter TargetName="HeaderPanel" Property="Grid.Row" Value="0" />
                            <Setter TargetName="ContentPanel" Property="Grid.Row" Value="0" />
                            <Setter TargetName="Indicator" Value="{Binding RelativeSource={RelativeSource Self},Path=(params:TabControl.IndicatorThickness)}" Property="Width" />
                            <Setter TargetName="Indicator" Property="Height" Value="NaN" />
                            <Setter TargetName="Indicator" Property="HorizontalAlignment" Value="Right" />
                            <Setter TargetName="Indicator" Property="VerticalAlignment" Value="Stretch" />
                        </Trigger>
                        <Trigger Property="TabControl.TabStripPlacement" Value="Right">
                            <Setter TargetName="FirstColumnDefinition" Property="Width" Value="*" />
                            <Setter TargetName="SecondColumnDefinition" Property="Width" Value="Auto" />
                            <Setter TargetName="FirstRowDefinition" Property="Height" Value="*" />
                            <Setter TargetName="SecondRowDefinition" Property="Height" Value="0" />
                            <Setter TargetName="Indicator" Property="Grid.Column" Value="1" />
                            <Setter TargetName="HeaderPanel" Property="Grid.Column" Value="1" />
                            <Setter TargetName="ContentPanel" Property="Grid.Column" Value="0" />
                            <Setter TargetName="Indicator" Property="Grid.Row" Value="0" />
                            <Setter TargetName="HeaderPanel" Property="Grid.Row" Value="0" />
                            <Setter TargetName="ContentPanel" Property="Grid.Row" Value="0" />
                            <Setter TargetName="Indicator" Value="{Binding RelativeSource={RelativeSource Self},Path=(params:TabControl.IndicatorThickness)}" Property="Width" />
                            <Setter TargetName="Indicator" Property="Height" Value="NaN" />
                            <Setter TargetName="Indicator" Property="HorizontalAlignment" Value="Left" />
                            <Setter TargetName="Indicator" Property="VerticalAlignment" Value="Stretch" />
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
        <Style.Triggers>
            <DataTrigger DataTrigger.Binding="{Binding RelativeSource={RelativeSource Self},Path=FontSize,Mode=OneWay,Converter={StaticResource IsGreaterThanConverter},ConverterParameter=18}">
                <Setter Property="TextOptions.TextFormattingMode" Value="Ideal" />
            </DataTrigger>
            <Trigger Property="IsEnabled" Value="False">
                <Setter Property="BorderBrush" Value="{StaticResource DisabledBrush}" />
                <Setter Property="Foreground" Value="{StaticResource DisabledBrush}" />
            </Trigger>
        </Style.Triggers>
    </Style>

    <Style x:Key="{x:Type primitives:CommandButtonBase}" TargetType="{x:Type primitives:CommandButtonBase}" >
        <Setter Property="Background" Value="{StaticResource BackgroundBrush}" />
        <Setter Property="BorderBrush" Value="{StaticResource LowlightBrush}" />
        <Setter Property="BorderThickness" Value="{Binding RelativeSource={RelativeSource Self},Path=(params:General.BoldThickness),Mode=OneWay}" />
        <Setter Property="params:CommandButtons.Mask" Value="{StaticResource LowlightBrush}" />
        <Setter Property="Foreground" Value="{StaticResource ForegroundBrush}" />
        <Setter Property="FontSize" Value="{Binding RelativeSource={RelativeSource Self},Path=(params:General.ContentFontSize),Mode=OneWay}" />
        <Setter Property="FontStretch" Value="Medium" />
        <Setter Property="FontStyle" Value="Normal" />
        <Setter Property="FontWeight" Value="Normal" />
        <Setter Property="TextOptions.TextFormattingMode" Value="Display" />
        <Setter Property="TextOptions.TextRenderingMode" Value="ClearType" />
        <Setter Property="RenderOptions.ClearTypeHint" Value="Enabled" />
        <Setter Property="FocusVisualStyle" Value="{StaticResource FocusVisualStyle}" />
        <Setter Property="Padding" Value="{Binding RelativeSource={RelativeSource Self},Path=(params:General.SemiBoldPadding),Mode=OneWay}" />
        <Setter Property="SnapsToDevicePixels" Value="True" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type primitives:CommandButtonBase}">
                    <Grid Panel.Background="{StaticResource TransparentBrush}" TextBlock.Foreground="{TemplateBinding Foreground}" TextBlock.FontFamily="{TemplateBinding Control.FontFamily}" TextBlock.FontSize="{TemplateBinding FontSize}" TextBlock.FontStretch="{TemplateBinding FontStretch}" TextBlock.FontStyle="{TemplateBinding FontStyle}" TextBlock.FontWeight="{TemplateBinding FontWeight}" TextOptions.TextFormattingMode="{TemplateBinding TextOptions.TextFormattingMode}" TextOptions.TextRenderingMode="{TemplateBinding TextOptions.TextRenderingMode}" RenderOptions.ClearTypeHint="{TemplateBinding RenderOptions.ClearTypeHint}" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}">
                        <Grid.RowDefinitions>
                            <RowDefinition Height="*" />
                            <RowDefinition Height="Auto" />
                        </Grid.RowDefinitions>
                        <Ellipse x:Name="PART_Decor" Grid.Row="0" Fill="{TemplateBinding Background}" Stroke="{TemplateBinding BorderBrush}" Stretch="Fill" HorizontalAlignment="Center" VerticalAlignment="Center" StrokeThickness="{Binding BorderThickness,RelativeSource={RelativeSource TemplatedParent},Converter={StaticResource ThicknessToDoubleConverter}}" />
                        <ContentPresenter x:Name="PART_ContentHost" Grid.Row="0" ContentPresenter.Content="{TemplateBinding ContentControl.Content}" ContentPresenter.ContentStringFormat="{TemplateBinding ContentControl.ContentStringFormat}" ContentPresenter.ContentTemplate="{TemplateBinding ContentControl.ContentTemplate}" ContentPresenter.ContentTemplateSelector="{TemplateBinding ContentControl.ContentTemplateSelector}" Margin="{TemplateBinding Padding}" RecognizesAccessKey="True" HorizontalAlignment="Center" VerticalAlignment="Center" />
                        <ContentPresenter x:Name="PART_HeaderHost" Grid.Row="1" ContentPresenter.Content="{TemplateBinding primitives:CommandButtonBase.Header}" ContentPresenter.ContentStringFormat="{TemplateBinding primitives:CommandButtonBase.HeaderStringFormat}" ContentPresenter.ContentTemplate="{TemplateBinding primitives:CommandButtonBase.HeaderTemplate}" ContentPresenter.ContentTemplateSelector="{TemplateBinding primitives:CommandButtonBase.HeaderTemplateSelector}" Margin="{TemplateBinding Padding}" HorizontalAlignment="Center" />
                    </Grid>
                    <ControlTemplate.Triggers>
                        <Trigger Value="{x:Null}" Property="primitives:CommandButtonBase.Header">
                            <Setter TargetName="PART_HeaderHost" Property="Visibility" Value="Collapsed" />
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
        <Style.Triggers>
            <DataTrigger DataTrigger.Binding="{Binding RelativeSource={RelativeSource Self},Path=FontSize,Mode=OneWay,Converter={StaticResource IsGreaterThanConverter},ConverterParameter=18}">
                <Setter Property="TextOptions.TextFormattingMode" Value="Ideal" />
            </DataTrigger>
            <Trigger Property="IsMouseOver" Value="True">
                <Setter Property="BorderBrush" Value="{StaticResource ForegroundBrush}" />
                <Setter Property="params:CommandButtons.Mask" Value="{StaticResource ForegroundBrush}" />
            </Trigger>
            <Trigger Property="IsPressed" Value="True">
                <Setter Property="BorderBrush" Value="{StaticResource MiddleLightBrush}" />
                <Setter Property="params:CommandButtons.Mask" Value="{StaticResource MiddleLightBrush}" />
            </Trigger>
            <Trigger Property="IsEnabled" Value="False">
                <Setter Property="BorderBrush" Value="{StaticResource DisabledBrush}" />
                <Setter Property="Foreground" Value="{StaticResource DisabledBrush}" />
                <Setter Property="params:CommandButtons.Mask" Value="{StaticResource DisabledBrush}" />
            </Trigger>
        </Style.Triggers>
    </Style>
    <Style x:Key="CommandButtonBaseApplicationBarStyle" TargetType="{x:Type primitives:CommandButtonBase}" >
        <Setter Property="Background" Value="{StaticResource TransparentBrush}" />
        <Setter Property="BorderBrush" Value="{StaticResource ContrastBrush}" />
        <Setter Property="BorderThickness" Value="{Binding RelativeSource={RelativeSource Self},Path=(params:General.BoldThickness),Mode=OneWay}" />
        <Setter Property="params:CommandButtons.Mask" Value="{StaticResource ContrastBrush}" />
        <Setter Property="Foreground" Value="{StaticResource ContrastBrush}" />
        <Setter Property="FontSize" Value="{Binding RelativeSource={RelativeSource Self},Path=(params:General.ContentFontSize),Mode=OneWay}" />
        <Setter Property="FontStretch" Value="Medium" />
        <Setter Property="FontStyle" Value="Normal" />
        <Setter Property="FontWeight" Value="Normal" />
        <Setter Property="FocusVisualStyle" Value="{StaticResource FocusVisualStyle}" />
        <Setter Property="Padding" Value="{Binding RelativeSource={RelativeSource Self},Path=(params:General.SemiBoldPadding),Mode=OneWay}" />
        <Setter Property="SnapsToDevicePixels" Value="True" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type primitives:CommandButtonBase}">
                    <Grid Panel.Background="{StaticResource TransparentBrush}" TextBlock.Foreground="{TemplateBinding Foreground}" TextBlock.FontFamily="{TemplateBinding Control.FontFamily}" TextBlock.FontSize="{TemplateBinding FontSize}" TextBlock.FontStretch="{TemplateBinding FontStretch}" TextBlock.FontStyle="{TemplateBinding FontStyle}" TextBlock.FontWeight="{TemplateBinding FontWeight}" TextOptions.TextFormattingMode="{TemplateBinding TextOptions.TextFormattingMode}" TextOptions.TextRenderingMode="{TemplateBinding TextOptions.TextRenderingMode}" RenderOptions.ClearTypeHint="{TemplateBinding RenderOptions.ClearTypeHint}" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}">
                        <Grid.RowDefinitions>
                            <RowDefinition Height="*" />
                            <RowDefinition Height="Auto" />
                        </Grid.RowDefinitions>
                        <Ellipse x:Name="PART_Decor" Grid.Row="0" Fill="{TemplateBinding Background}" Stroke="{TemplateBinding BorderBrush}" Stretch="Fill" HorizontalAlignment="Center" VerticalAlignment="Center" StrokeThickness="{Binding BorderThickness,RelativeSource={RelativeSource TemplatedParent},Converter={StaticResource ThicknessToDoubleConverter}}" />
                        <Ellipse Grid.Row="0" Fill="{TemplateBinding params:CommandButtons.Mask}" Stroke="{StaticResource TransparentBrush}" Stretch="Fill" HorizontalAlignment="Center" VerticalAlignment="Center" StrokeThickness="{Binding BorderThickness,RelativeSource={RelativeSource TemplatedParent},Converter={StaticResource ThicknessToDoubleConverter}}" Width="{Binding ElementName=PART_Decor,Path=ActualWidth,Mode=OneWay}" Height="{Binding ElementName=PART_Decor,Path=ActualHeight,Mode=OneWay}">
                            <UIElement.OpacityMask>
                                <VisualBrush VisualBrush.AutoLayoutContent="True" TileBrush.AlignmentX="Center" TileBrush.AlignmentY="Center" TileBrush.Stretch="None">
                                    <VisualBrush.Visual>
                                        <ContentPresenter x:Name="PART_ContentHost" ContentPresenter.Content="{TemplateBinding ContentControl.Content}" ContentPresenter.ContentStringFormat="{TemplateBinding ContentControl.ContentStringFormat}" ContentPresenter.ContentTemplate="{TemplateBinding ContentControl.ContentTemplate}" ContentPresenter.ContentTemplateSelector="{TemplateBinding ContentControl.ContentTemplateSelector}" Margin="{TemplateBinding Padding}" RecognizesAccessKey="True" />
                                    </VisualBrush.Visual>
                                </VisualBrush>
                            </UIElement.OpacityMask>
                        </Ellipse>
                        <ContentPresenter x:Name="PART_HeaderHost" Grid.Row="1" ContentPresenter.Content="{TemplateBinding primitives:CommandButtonBase.Header}" ContentPresenter.ContentStringFormat="{TemplateBinding primitives:CommandButtonBase.HeaderStringFormat}" ContentPresenter.ContentTemplate="{TemplateBinding primitives:CommandButtonBase.HeaderTemplate}" ContentPresenter.ContentTemplateSelector="{TemplateBinding primitives:CommandButtonBase.HeaderTemplateSelector}" Margin="{TemplateBinding Padding}" HorizontalAlignment="Center" />
                    </Grid>
                    <ControlTemplate.Triggers>
                        <Trigger Value="{x:Null}" Property="primitives:CommandButtonBase.Header">
                            <Setter TargetName="PART_HeaderHost" Property="Visibility" Value="Collapsed" />
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
        <Style.Triggers>
            <DataTrigger DataTrigger.Binding="{Binding RelativeSource={RelativeSource Self},Path=FontSize,Mode=OneWay,Converter={StaticResource IsGreaterThanConverter},ConverterParameter=18}">
                <Setter Property="TextOptions.TextFormattingMode" Value="Ideal" />
            </DataTrigger>
            <Trigger Property="IsMouseOver" Value="True">
                <Setter Property="Background" Value="{StaticResource SemitransparentContrastBrush}" />
                <Setter Property="BorderBrush" Value="{StaticResource ContrastBrush}" />
                <Setter Property="params:CommandButtons.Mask" Value="{StaticResource ContrastBrush}" />
            </Trigger>
            <Trigger Property="IsPressed" Value="True">
                <Setter Property="Background" Value="{StaticResource ContrastBrush}" />
                <Setter Property="BorderBrush" Value="{StaticResource ContrastBrush}" />
                <Setter Property="params:CommandButtons.Mask" Value="{StaticResource AccentBrush}" />
            </Trigger>
            <Trigger Property="IsEnabled" Value="False">
                <Setter Property="BorderBrush" Value="{StaticResource DisabledBrush}" />
                <Setter Property="Foreground" Value="{StaticResource DisabledBrush}" />
                <Setter Property="params:CommandButtons.Mask" Value="{StaticResource DisabledBrush}" />
            </Trigger>
        </Style.Triggers>
    </Style>

    <Style x:Key="{x:Type controls:CommandButton}" TargetType="{x:Type controls:CommandButton}" BasedOn="{StaticResource {x:Type primitives:CommandButtonBase}}"  />
    <Style x:Key="CommandButtonApplicationBarStyle" TargetType="{x:Type controls:CommandButton}" BasedOn="{StaticResource CommandButtonBaseApplicationBarStyle}"  />

    <Style x:Key="{x:Type controls:ToggleCommandButton}" TargetType="{x:Type controls:ToggleCommandButton}" BasedOn="{StaticResource {x:Type primitives:CommandButtonBase}}" >
        <Style.Triggers>
            <Trigger Property="controls:ToggleCommandButton.IsChecked" Value="True">
                <Setter Property="BorderBrush" Value="{StaticResource MiddleLightBrush}" />
                <Setter Property="params:CommandButtons.Mask" Value="{StaticResource MiddleLightBrush}" />
            </Trigger>
        </Style.Triggers>
    </Style>
    <Style x:Key="ToggleCommandButtonApplicationBarStyle" TargetType="{x:Type controls:ToggleCommandButton}" BasedOn="{StaticResource CommandButtonBaseApplicationBarStyle}" >
        <Style.Triggers>
            <Trigger Property="controls:ToggleCommandButton.IsChecked" Value="True">
                <Setter Property="Background" Value="{StaticResource ContrastBrush}" />
                <Setter Property="BorderBrush" Value="{StaticResource ContrastBrush}" />
                <Setter Property="params:CommandButtons.Mask" Value="{StaticResource AccentBrush}" />
            </Trigger>
        </Style.Triggers>
    </Style>

    <Style x:Key="DropDownCommandButtonSubmenuStyle" TargetType="{x:Type controls:Submenu}" BasedOn="{StaticResource {x:Type controls:Submenu}}" >
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type controls:Submenu}">
                    <Border x:Name="LayoutRoot" FrameworkElement.Tag="{DynamicResource {x:Static SystemParameters.DropShadowKey}}">
                        <ScrollViewer Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Foreground="{TemplateBinding Foreground}" Control.FontFamily="{TemplateBinding Control.FontFamily}" FontSize="{TemplateBinding FontSize}" FontStretch="{TemplateBinding FontStretch}" FontStyle="{TemplateBinding FontStyle}" FontWeight="{TemplateBinding FontWeight}" TextOptions.TextFormattingMode="{TemplateBinding TextOptions.TextFormattingMode}" TextOptions.TextRenderingMode="{TemplateBinding TextOptions.TextRenderingMode}" RenderOptions.ClearTypeHint="{TemplateBinding RenderOptions.ClearTypeHint}" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}">
                            <FrameworkElement.Resources>
                                <ResourceDictionary>
                                    <Style TargetType="{x:Type ScrollBar}" BasedOn="{StaticResource {x:Type ScrollBar}}">
                                        <Style.Triggers>
                                            <Trigger Property="ScrollBar.Orientation" Value="Vertical">
                                                <Setter Property="BorderThickness" Value="0" />
                                            </Trigger>
                                        </Style.Triggers>
                                    </Style>
                                </ResourceDictionary>
                            </FrameworkElement.Resources>
                            <ItemsPresenter KeyboardNavigation.DirectionalNavigation="Cycle" />
                        </ScrollViewer>
                    </Border>
                    <ControlTemplate.Triggers>
                        <DataTrigger Value="True" DataTrigger.Binding="{Binding ElementName=LayoutRoot,Path=Tag}">
                            <Setter TargetName="LayoutRoot" Property="UIElement.Effect">
                                <Setter.Value>
                                    <DropShadowEffect DropShadowEffect.BlurRadius="4" DropShadowEffect.ShadowDepth="0" DropShadowEffect.Direction="90" DropShadowEffect.Opacity="0.7" DropShadowEffect.Color="{Binding RelativeSource={RelativeSource AncestorType={x:Type controls:Submenu}},Path=(params:General.ShadowBrush).(SolidColorBrush.Color)}" />
                                </Setter.Value>
                            </Setter>
                            <Setter TargetName="LayoutRoot" Value="{StaticResource TransparentBrush}" Property="Border.Background" />
                            <Setter TargetName="LayoutRoot" Property="Border.Padding" Value="4" />
                        </DataTrigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
    <Style x:Key="{x:Type controls:DropDownCommandButton}" TargetType="{x:Type controls:DropDownCommandButton}" BasedOn="{StaticResource {x:Type primitives:CommandButtonBase}}" >
        <Style.Resources>
            <ResourceDictionary>
                <Style TargetType="{x:Type controls:Submenu}" BasedOn="{StaticResource DropDownCommandButtonSubmenuStyle}" />
            </ResourceDictionary>
        </Style.Resources>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type controls:DropDownCommandButton}">
                    <Grid Panel.Background="{StaticResource TransparentBrush}" TextBlock.Foreground="{TemplateBinding Foreground}" TextBlock.FontFamily="{TemplateBinding Control.FontFamily}" TextBlock.FontSize="{TemplateBinding FontSize}" TextBlock.FontStretch="{TemplateBinding FontStretch}" TextBlock.FontStyle="{TemplateBinding FontStyle}" TextBlock.FontWeight="{TemplateBinding FontWeight}" TextOptions.TextFormattingMode="{TemplateBinding TextOptions.TextFormattingMode}" TextOptions.TextRenderingMode="{TemplateBinding TextOptions.TextRenderingMode}" RenderOptions.ClearTypeHint="{TemplateBinding RenderOptions.ClearTypeHint}" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}">
                        <Grid.RowDefinitions>
                            <RowDefinition Height="*" />
                            <RowDefinition Height="Auto" />
                        </Grid.RowDefinitions>
                        <Ellipse x:Name="PART_Decor" Grid.Row="0" Fill="{TemplateBinding Background}" Stroke="{TemplateBinding BorderBrush}" Stretch="Fill" HorizontalAlignment="Center" VerticalAlignment="Center" StrokeThickness="{Binding BorderThickness,RelativeSource={RelativeSource TemplatedParent},Converter={StaticResource ThicknessToDoubleConverter}}" />
                        <ContentPresenter x:Name="PART_ContentHost" Grid.Row="0" ContentPresenter.Content="{TemplateBinding ContentControl.Content}" ContentPresenter.ContentStringFormat="{TemplateBinding ContentControl.ContentStringFormat}" ContentPresenter.ContentTemplate="{TemplateBinding ContentControl.ContentTemplate}" ContentPresenter.ContentTemplateSelector="{TemplateBinding ContentControl.ContentTemplateSelector}" Margin="{TemplateBinding Padding}" RecognizesAccessKey="True" HorizontalAlignment="Center" VerticalAlignment="Center" />
                        <ContentPresenter x:Name="PART_HeaderHost" Grid.Row="1" ContentPresenter.Content="{TemplateBinding primitives:CommandButtonBase.Header}" ContentPresenter.ContentStringFormat="{TemplateBinding primitives:CommandButtonBase.HeaderStringFormat}" ContentPresenter.ContentTemplate="{TemplateBinding primitives:CommandButtonBase.HeaderTemplate}" ContentPresenter.ContentTemplateSelector="{TemplateBinding primitives:CommandButtonBase.HeaderTemplateSelector}" Margin="{TemplateBinding Padding}" HorizontalAlignment="Center" />
                        <Popup x:Name="PART_Popup" Grid.Row="1" Popup.AllowsTransparency="True" Popup.StaysOpen="False" Popup.Placement="Custom" Popup.VerticalOffset="{TemplateBinding params:General.BoldPaddingValue}" MaxHeight="{TemplateBinding controls:DropDownCommandButton.MaxDropDownHeight}" Popup.IsOpen="{Binding RelativeSource={RelativeSource TemplatedParent},Path=IsDropDownOpen,Mode=TwoWay}" />
                    </Grid>
                    <ControlTemplate.Triggers>
                        <Trigger Value="{x:Null}" Property="primitives:CommandButtonBase.Header">
                            <Setter TargetName="PART_HeaderHost" Property="Visibility" Value="Collapsed" />
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
        <Style.Triggers>
            <Trigger Property="controls:DropDownCommandButton.IsDropDownOpen" Value="True">
                <Setter Property="BorderBrush" Value="{StaticResource MiddleLightBrush}" />
                <Setter Property="params:CommandButtons.Mask" Value="{StaticResource MiddleLightBrush}" />
            </Trigger>
        </Style.Triggers>
    </Style>
    <Style x:Key="DropDownCommandButtonApplicationBarStyle" TargetType="{x:Type controls:DropDownCommandButton}" BasedOn="{StaticResource CommandButtonBaseApplicationBarStyle}" >
        <Style.Resources>
            <ResourceDictionary>
                <Style TargetType="{x:Type controls:Submenu}" BasedOn="{StaticResource DropDownCommandButtonSubmenuStyle}" />
            </ResourceDictionary>
        </Style.Resources>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type controls:DropDownCommandButton}">
                    <Grid Panel.Background="{StaticResource TransparentBrush}" TextBlock.Foreground="{TemplateBinding Foreground}" TextBlock.FontFamily="{TemplateBinding Control.FontFamily}" TextBlock.FontSize="{TemplateBinding FontSize}" TextBlock.FontStretch="{TemplateBinding FontStretch}" TextBlock.FontStyle="{TemplateBinding FontStyle}" TextBlock.FontWeight="{TemplateBinding FontWeight}" TextOptions.TextFormattingMode="{TemplateBinding TextOptions.TextFormattingMode}" TextOptions.TextRenderingMode="{TemplateBinding TextOptions.TextRenderingMode}" RenderOptions.ClearTypeHint="{TemplateBinding RenderOptions.ClearTypeHint}" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}">
                        <Grid.RowDefinitions>
                            <RowDefinition Height="*" />
                            <RowDefinition Height="Auto" />
                        </Grid.RowDefinitions>
                        <Ellipse x:Name="PART_Decor" Grid.Row="0" Fill="{TemplateBinding Background}" Stroke="{TemplateBinding BorderBrush}" Stretch="Fill" HorizontalAlignment="Center" VerticalAlignment="Center" StrokeThickness="{Binding BorderThickness,RelativeSource={RelativeSource TemplatedParent},Converter={StaticResource ThicknessToDoubleConverter}}" />
                        <Ellipse Grid.Row="0" Fill="{TemplateBinding params:CommandButtons.Mask}" Stroke="{StaticResource TransparentBrush}" Stretch="Fill" HorizontalAlignment="Center" VerticalAlignment="Center" StrokeThickness="{Binding BorderThickness,RelativeSource={RelativeSource TemplatedParent},Converter={StaticResource ThicknessToDoubleConverter}}" Width="{Binding ElementName=PART_Decor,Path=ActualWidth,Mode=OneWay}" Height="{Binding ElementName=PART_Decor,Path=ActualHeight,Mode=OneWay}">
                            <UIElement.OpacityMask>
                                <VisualBrush VisualBrush.AutoLayoutContent="True" TileBrush.AlignmentX="Center" TileBrush.AlignmentY="Center" TileBrush.Stretch="None">
                                    <VisualBrush.Visual>
                                        <ContentPresenter x:Name="PART_ContentHost" ContentPresenter.Content="{TemplateBinding ContentControl.Content}" ContentPresenter.ContentStringFormat="{TemplateBinding ContentControl.ContentStringFormat}" ContentPresenter.ContentTemplate="{TemplateBinding ContentControl.ContentTemplate}" ContentPresenter.ContentTemplateSelector="{TemplateBinding ContentControl.ContentTemplateSelector}" Margin="{TemplateBinding Padding}" RecognizesAccessKey="True" />
                                    </VisualBrush.Visual>
                                </VisualBrush>
                            </UIElement.OpacityMask>
                        </Ellipse>
                        <ContentPresenter x:Name="PART_HeaderHost" Grid.Row="1" ContentPresenter.Content="{TemplateBinding primitives:CommandButtonBase.Header}" ContentPresenter.ContentStringFormat="{TemplateBinding primitives:CommandButtonBase.HeaderStringFormat}" ContentPresenter.ContentTemplate="{TemplateBinding primitives:CommandButtonBase.HeaderTemplate}" ContentPresenter.ContentTemplateSelector="{TemplateBinding primitives:CommandButtonBase.HeaderTemplateSelector}" Margin="{TemplateBinding Padding}" HorizontalAlignment="Center" />
                        <Popup x:Name="PART_Popup" Grid.Row="1" Popup.AllowsTransparency="True" Popup.StaysOpen="False" Popup.Placement="Custom" Popup.VerticalOffset="{TemplateBinding params:General.BoldPaddingValue}" MaxHeight="{TemplateBinding controls:DropDownCommandButton.MaxDropDownHeight}" Popup.IsOpen="{Binding RelativeSource={RelativeSource TemplatedParent},Path=IsDropDownOpen,Mode=TwoWay}" />
                    </Grid>
                    <ControlTemplate.Triggers>
                        <Trigger Value="{x:Null}" Property="primitives:CommandButtonBase.Header">
                            <Setter TargetName="PART_HeaderHost" Property="Visibility" Value="Collapsed" />
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
        <Style.Triggers>
            <Trigger Property="controls:DropDownCommandButton.IsDropDownOpen" Value="True">
                <Setter Property="Background" Value="{StaticResource ContrastBrush}" />
                <Setter Property="BorderBrush" Value="{StaticResource ContrastBrush}" />
                <Setter Property="params:CommandButtons.Mask" Value="{StaticResource AccentBrush}" />
            </Trigger>
        </Style.Triggers>
    </Style>

    <Style x:Key="{x:Type controls:ApplicationBar}" TargetType="{x:Type controls:ApplicationBar}" >
        <Style.Resources>
            <ResourceDictionary>
                <Style TargetType="{x:Type controls:CommandButton}" BasedOn="{StaticResource CommandButtonApplicationBarStyle}" />
                <Style TargetType="{x:Type controls:ToggleCommandButton}" BasedOn="{StaticResource ToggleCommandButtonApplicationBarStyle}" />
                <Style TargetType="{x:Type controls:DropDownCommandButton}" BasedOn="{StaticResource DropDownCommandButtonApplicationBarStyle}" />
            </ResourceDictionary>
        </Style.Resources>
        <Setter Property="Background" Value="{StaticResource AccentBrush}" />
        <Setter Property="BorderBrush" Value="{StaticResource LowlightBrush}" />
        <Setter Property="BorderThickness" Value="0" />
        <Setter Property="Foreground" Value="{StaticResource ForegroundBrush}" />
        <Setter Property="FontSize" Value="{Binding RelativeSource={RelativeSource Self},Path=(params:General.ContentFontSize),Mode=OneWay}" />
        <Setter Property="FontStretch" Value="Medium" />
        <Setter Property="FontStyle" Value="Normal" />
        <Setter Property="FontWeight" Value="Normal" />
        <Setter Property="TextOptions.TextFormattingMode" Value="Display" />
        <Setter Property="TextOptions.TextRenderingMode" Value="ClearType" />
        <Setter Property="RenderOptions.ClearTypeHint" Value="Enabled" />
        <Setter Property="HorizontalContentAlignment" Value="Stretch" />
        <Setter Property="VerticalContentAlignment" Value="Stretch" />
        <Setter Property="Padding" Value="{Binding RelativeSource={RelativeSource Self},Path=(params:General.BoldPadding),Mode=OneWay}" />
        <Setter Property="SnapsToDevicePixels" Value="True" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type controls:ApplicationBar}">
                    <Border Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" TextBlock.Foreground="{TemplateBinding Foreground}" TextBlock.FontFamily="{TemplateBinding Control.FontFamily}" TextBlock.FontSize="{TemplateBinding FontSize}" TextBlock.FontStretch="{TemplateBinding FontStretch}" TextBlock.FontStyle="{TemplateBinding FontStyle}" TextBlock.FontWeight="{TemplateBinding FontWeight}" TextOptions.TextFormattingMode="{TemplateBinding TextOptions.TextFormattingMode}" TextOptions.TextRenderingMode="{TemplateBinding TextOptions.TextRenderingMode}" RenderOptions.ClearTypeHint="{TemplateBinding RenderOptions.ClearTypeHint}" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}">
                        <ItemsPresenter />
                    </Border>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
        <Style.Triggers>
            <DataTrigger DataTrigger.Binding="{Binding RelativeSource={RelativeSource Self},Path=FontSize,Mode=OneWay,Converter={StaticResource IsGreaterThanConverter},ConverterParameter=18}">
                <Setter Property="TextOptions.TextFormattingMode" Value="Ideal" />
            </DataTrigger>
        </Style.Triggers>
    </Style>


    <!--<Style x:Key="{x:Type ToolTip}" TargetType="{x:Type ToolTip}" >
        <Setter Property="Background" Value="{StaticResource BackgroundBrush}" />
        <Setter Property="BorderBrush" Value="{StaticResource MiddleLightBrush}" />
        <Setter Property="BorderThickness" Value="{Binding RelativeSource={RelativeSource Self},Path=(params:General.DefaultThickness),Mode=OneWay}" />
        <Setter Property="Foreground" Value="{StaticResource ForegroundBrush}" />
        <Setter Property="FontSize" Value="{Binding RelativeSource={RelativeSource Self},Path=(params:General.TextFontSize),Mode=OneWay}" />
        <Setter Property="FontStretch" Value="Medium" />
        <Setter Property="FontStyle" Value="Normal" />
        <Setter Property="FontWeight" Value="Normal" />
        <Setter Property="TextOptions.TextFormattingMode" Value="Display" />
        <Setter Property="TextOptions.TextRenderingMode" Value="ClearType" />
        <Setter Property="RenderOptions.ClearTypeHint" Value="Enabled" />
        <Setter Property="HasDropShadow" Value="{DynamicResource {x:Static SystemParameters.DropShadowKey}}" />
        <Setter Property="params:General.ShadowBrush" Value="{StaticResource ForegroundBrush}" />
        <Setter Property="Focusable" Value="False" />
        <Setter Property="FocusVisualStyle" Value="{x:Null}" />
        <Setter Property="HorizontalContentAlignment" Value="Left" />
        <Setter Property="VerticalContentAlignment" Value="Center" />
        <Setter Property="Padding" Value="{Binding RelativeSource={RelativeSource Self},Path=(params:General.BoldPadding),Mode=OneWay}" />
        <Setter Property="SnapsToDevicePixels" Value="True" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type ToolTip}">
                    <Border x:Name="LayoutRoot">
                        <Border Background="{TemplateBinding Background}" 
                                BorderBrush="{TemplateBinding BorderBrush}" 
                                BorderThickness="{TemplateBinding BorderThickness}" 
                                TextBlock.Foreground="{TemplateBinding Foreground}" 
                                TextBlock.FontFamily="{TemplateBinding FontFamily}" 
                                TextBlock.FontSize="{TemplateBinding FontSize}" 
                                TextBlock.FontStretch="{TemplateBinding FontStretch}" 
                                TextBlock.FontStyle="{TemplateBinding FontStyle}" 
                                TextBlock.FontWeight="{TemplateBinding FontWeight}" 
                                TextOptions.TextFormattingMode="{TemplateBinding TextOptions.TextFormattingMode}" 
                                TextOptions.TextRenderingMode="{TemplateBinding TextOptions.TextRenderingMode}" 
                                RenderOptions.ClearTypeHint="{TemplateBinding RenderOptions.ClearTypeHint}" 
                                Padding="{TemplateBinding Padding}" 
                                SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}">
                            <ContentPresenter HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" 
                                              VerticalAlignment="{TemplateBinding VerticalContentAlignment}" 
                                              SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
                        </Border>
                    </Border>
                    <ControlTemplate.Triggers>
                        <Trigger Property="HasDropShadow" Value="True">
                            <Setter TargetName="LayoutRoot" Property="Effect">
                                <Setter.Value>
                                    <DropShadowEffect BlurRadius="5" 
                                                      ShadowDepth="2" 
                                                      Direction="315" 
                                                      Opacity="0.1" 
                                                      Color="{Binding RelativeSource={RelativeSource AncestorType={x:Type ToolTip}},Path=(params:General.ShadowBrush).(SolidColorBrush.Color)}" />
                                </Setter.Value>
                            </Setter>
                            <Setter TargetName="LayoutRoot" Value="{StaticResource TransparentBrush}" Property="Border.Background" />
                            <Setter TargetName="LayoutRoot" Property="Border.Padding" Value="0,0,6,6" />
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
        <Style.Triggers>
            <DataTrigger Binding="{Binding RelativeSource={RelativeSource Self},Path=FontSize,Mode=OneWay,Converter={StaticResource IsGreaterThanConverter},ConverterParameter=18}">
                <Setter Property="TextOptions.TextFormattingMode" Value="Ideal" />
            </DataTrigger>
        </Style.Triggers>
    </Style>-->

    <Style x:Key="{x:Static controls:Window.DefaultCaptionButtonStyleKey}" TargetType="{x:Type Button}" BasedOn="{StaticResource {x:Type Button}}">
        <Setter Property="Background" Value="{DynamicResource TransparentBrush}" />
        <Setter Property="BorderBrush" Value="{DynamicResource TransparentBrush}" />
        <Setter Property="Foreground" Value="{DynamicResource ForegroundBrush}" />
        <Setter Property="FocusVisualStyle" Value="{x:Null}" />
        <Setter Property="IsTabStop" Value="false" />
        <Setter Property="MinWidth" Value="32" />
        <Setter Property="MinHeight" Value="32" />
        <Setter Property="ToolTipService.ShowOnDisabled" Value="true" />
        <Style.Triggers>
            <Trigger Property="IsMouseOver" Value="true">
                <Setter Property="Background" Value="{DynamicResource HighlightBrush}" />
                <Setter Property="BorderBrush" Value="{DynamicResource HighlightBrush}" />
                <Setter Property="Foreground" Value="{DynamicResource ForegroundBrush}" />
            </Trigger>
            <Trigger Property="IsPressed" Value="true">
                <Setter Property="Background" Value="{DynamicResource AccentBrush}" />
                <Setter Property="BorderBrush" Value="{DynamicResource AccentBrush}" />
                <Setter Property="Foreground" Value="{DynamicResource ContrastBrush}" />
            </Trigger>
        </Style.Triggers>
    </Style>
    <Style x:Key="{x:Static controls:Window.MainWindowCaptionButtonStyleKey}" TargetType="{x:Type Button}" BasedOn="{StaticResource {x:Type Button}}">
        <Setter Property="Background" Value="{DynamicResource AccentBrush}" />
        <Setter Property="BorderBrush" Value="{DynamicResource AccentBrush}" />
        <Setter Property="Foreground" Value="{DynamicResource ContrastBrush}" />
        <Setter Property="FocusVisualStyle" Value="{x:Null}" />
        <Setter Property="IsTabStop" Value="false" />
        <Setter Property="MinWidth" Value="32" />
        <Setter Property="MinHeight" Value="32" />
        <Setter Property="ToolTipService.ShowOnDisabled" Value="true" />
        <Style.Triggers>
            <Trigger Property="IsMouseOver" Value="true">
                <Setter Property="Background" Value="{DynamicResource SemitransparentContrastBrush}" />
                <Setter Property="BorderBrush" Value="{DynamicResource SemitransparentContrastBrush}" />
                <Setter Property="Foreground" Value="{DynamicResource ContrastBrush}" />
            </Trigger>
            <Trigger Property="IsPressed" Value="true">
                <Setter Property="Background" Value="{DynamicResource ContrastBrush}" />
                <Setter Property="BorderBrush" Value="{DynamicResource ContrastBrush}" />
                <Setter Property="Foreground" Value="{DynamicResource AccentBrush}" />
            </Trigger>
        </Style.Triggers>
    </Style>
    <Style x:Key="{x:Type controls:Window}" TargetType="{x:Type controls:Window}">
        <Setter Property="Background" Value="{DynamicResource BackgroundBrush}"/>
        <Setter Property="BorderBrush" Value="{DynamicResource AccentBrush}"/>
        <Setter Property="BorderThickness" Value="0"/>
        <Setter Property="Foreground" Value="{DynamicResource ForegroundBrush}"/>
        <Setter Property="FontFamily" Value="Segoe UI"/>
        <Setter Property="FontSize" Value="{Binding (params:General.TextFontSize), Mode=OneWay, RelativeSource={RelativeSource Self}}"/>
        <Setter Property="FontStretch" Value="Normal"/>
        <Setter Property="FontStyle" Value="Normal"/>
        <Setter Property="FontWeight" Value="Normal"/>
        <Setter Property="TextOptions.TextFormattingMode" Value="Display"/>
        <Setter Property="TextOptions.TextRenderingMode" Value="ClearType"/>
        <Setter Property="RenderOptions.ClearTypeHint" Value="Enabled"/>
        <Setter Property="HasDropShadow" Value="{DynamicResource {x:Static SystemParameters.DropShadowKey}}"/>
        <Setter Property="FocusVisualStyle" Value="{x:Null}"/>
        <Setter Property="Focusable" Value="True"/>
        <Setter Property="ResizeMode" Value="CanResizeWithGrip"/>
        <Setter Property="HorizontalContentAlignment" Value="Stretch"/>
        <Setter Property="VerticalContentAlignment" Value="Stretch"/>
        <Setter Property="Padding" Value="0"/>
        <Setter Property="SnapsToDevicePixels" Value="True"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type controls:Window}">
                    <Border BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" UseLayoutRounding="True">
                        <Grid x:Name="PART_LayoutRoot">
                            <Grid.RowDefinitions>
                                <RowDefinition Height="Auto"/>
                                <RowDefinition Height="*"/>
                            </Grid.RowDefinitions>
                            <Grid x:Name="PART_Caption" Grid.Row="0">
                                <Grid.ColumnDefinitions>
                                    <ColumnDefinition Width="Auto"/>
                                    <ColumnDefinition Width="*"/>
                                    <ColumnDefinition Width="Auto"/>
                                    <ColumnDefinition Width="Auto"/>
                                </Grid.ColumnDefinitions>
                                <Grid.RowDefinitions>
                                    <RowDefinition Height="Auto"/>
                                    <RowDefinition Height="Auto"/>
                                </Grid.RowDefinitions>
                                <Image x:Name="PART_Icon" Grid.Column="0" Grid.Row="0" Grid.RowSpan="2" Source="{TemplateBinding Icon}"/>
                                <TextBlock x:Name="PART_Title" Grid.Column="1" FontWeight="Normal" FontSize="{Binding (params:General.TitleFontSize), Mode=OneWay, RelativeSource={RelativeSource TemplatedParent}}" Margin="{Binding (params:General.BoldPadding), Mode=OneWay, RelativeSource={RelativeSource TemplatedParent}}" Grid.Row="0" Grid.RowSpan="2" Text="{TemplateBinding Title}" TextTrimming="CharacterEllipsis" VerticalAlignment="Center"/>
                                <Decorator Grid.Column="2" controls:Window.IsTitleBarHost="True" WindowChrome.IsHitTestVisibleInChrome="True" Grid.Row="0" Grid.RowSpan="2"/>
                                <Grid Grid.Column="3" WindowChrome.IsHitTestVisibleInChrome="True" Grid.Row="0" Grid.RowSpan="2">
                                    <Grid.ColumnDefinitions>
                                        <ColumnDefinition Width="Auto"/>
                                        <ColumnDefinition Width="Auto"/>
                                        <ColumnDefinition Width="Auto"/>
                                    </Grid.ColumnDefinitions>
                                    <Button x:Name="PART_Minimize" BorderThickness="0" Grid.Column="0" Style="{DynamicResource {ComponentResourceKey ResourceId=DefaultCaptionButtonStyleKey, TypeInTargetAssembly={x:Type controls:Window}}}" ToolTip="{Binding (params:Window.MinimizeButtonToolTip), Mode=OneWay, RelativeSource={RelativeSource TemplatedParent}}">
                                        <Button.Command>
                                            <RoutedUICommand Text="Minimize"/>
                                        </Button.Command>
                                        <Path RenderOptions.EdgeMode="Aliased" Fill="{Binding Foreground, Mode=OneWay, RelativeSource={RelativeSource FindAncestor, AncestorLevel=1, AncestorType={x:Type Button}}}" Height="10" Stretch="None" Width="10">
                                            <Path.Data>
                                                <GeometryGroup FillRule="EvenOdd">
                                                    <RectangleGeometry Rect="0,0,10,10"/>
                                                    <RectangleGeometry Rect="0,0,10,7"/>
                                                </GeometryGroup>
                                            </Path.Data>
                                        </Path>
                                    </Button>
                                    <Button x:Name="PART_Maximize" BorderThickness="0" Grid.Column="1" Style="{DynamicResource {ComponentResourceKey ResourceId=DefaultCaptionButtonStyleKey, TypeInTargetAssembly={x:Type controls:Window}}}" ToolTip="{Binding (params:Window.MaximizeButtonToolTip), Mode=OneWay, RelativeSource={RelativeSource TemplatedParent}}">
                                        <Button.Command>
                                            <RoutedUICommand Text="Maximize"/>
                                        </Button.Command>
                                        <Path RenderOptions.EdgeMode="Aliased" Height="10" Stretch="None" Stroke="{Binding Foreground, Mode=OneWay, RelativeSource={RelativeSource FindAncestor, AncestorLevel=1, AncestorType={x:Type Button}}}" Width="10">
                                            <Path.Data>
                                                <GeometryGroup>
                                                    <LineGeometry EndPoint="10,0.5" StartPoint="0,0.5"/>
                                                    <LineGeometry EndPoint="10,1.5" StartPoint="0,1.5"/>
                                                    <LineGeometry EndPoint="10,2.5" StartPoint="0,2.5"/>
                                                    <LineGeometry EndPoint="0.5,10" StartPoint="0.5,3"/>
                                                    <LineGeometry EndPoint="9.5,10" StartPoint="9.5,3"/>
                                                    <LineGeometry EndPoint="9,9.5" StartPoint="1,9.5"/>
                                                </GeometryGroup>
                                            </Path.Data>
                                        </Path>
                                    </Button>
                                    <Button x:Name="PART_Restore" BorderThickness="0" Grid.Column="1" Style="{DynamicResource {ComponentResourceKey ResourceId=DefaultCaptionButtonStyleKey, TypeInTargetAssembly={x:Type controls:Window}}}" ToolTip="{Binding (params:Window.RestoreButtonToolTip), Mode=OneWay, RelativeSource={RelativeSource TemplatedParent}}" Visibility="Hidden">
                                        <Button.Command>
                                            <RoutedUICommand Text="Restore"/>
                                        </Button.Command>
                                        <Path RenderOptions.EdgeMode="Aliased" Height="10" Stretch="None" Stroke="{Binding Foreground, Mode=OneWay, RelativeSource={RelativeSource FindAncestor, AncestorLevel=1, AncestorType={x:Type Button}}}" Width="10">
                                            <Path.Data>
                                                <GeometryGroup>
                                                    <LineGeometry EndPoint="10,0.5" StartPoint="3,0.5"/>
                                                    <LineGeometry EndPoint="10,1.5" StartPoint="3,1.5"/>
                                                    <LineGeometry EndPoint="3.5,3" StartPoint="3.5,2"/>
                                                    <LineGeometry EndPoint="9.5,7" StartPoint="9.5,2"/>
                                                    <LineGeometry EndPoint="10,6.5" StartPoint="7,6.5"/>
                                                    <LineGeometry EndPoint="7,3.5" StartPoint="0,3.5"/>
                                                    <LineGeometry EndPoint="7,4.5" StartPoint="0,4.5"/>
                                                    <LineGeometry EndPoint="0.5,10" StartPoint="0.5,5"/>
                                                    <LineGeometry EndPoint="6.5,10" StartPoint="6.5,5"/>
                                                    <LineGeometry EndPoint="6,9.5" StartPoint="1,9.5"/>
                                                </GeometryGroup>
                                            </Path.Data>
                                        </Path>
                                    </Button>
                                    <Button x:Name="PART_Close" BorderThickness="0" Grid.Column="2" Style="{DynamicResource {ComponentResourceKey ResourceId=DefaultCaptionButtonStyleKey, TypeInTargetAssembly={x:Type controls:Window}}}" ToolTip="{Binding (params:Window.CloseButtonToolTip), Mode=OneWay, RelativeSource={RelativeSource TemplatedParent}}">
                                        <Button.Command>
                                            <RoutedUICommand Text="Close"/>
                                        </Button.Command>
                                        <Path RenderOptions.EdgeMode="Aliased" Height="10" Stretch="None" Stroke="{Binding Foreground, Mode=OneWay, RelativeSource={RelativeSource FindAncestor, AncestorLevel=1, AncestorType={x:Type Button}}}" Width="10">
                                            <Path.Data>
                                                <GeometryGroup>
                                                    <LineGeometry EndPoint="10,9" StartPoint="1,0"/>
                                                    <LineGeometry EndPoint="9,10" StartPoint="0,1"/>
                                                    <LineGeometry EndPoint="9,9" StartPoint="1,1"/>
                                                    <LineGeometry EndPoint="0,9" StartPoint="9,0"/>
                                                    <LineGeometry EndPoint="1,10" StartPoint="10,1"/>
                                                    <LineGeometry EndPoint="1,9" StartPoint="9,1"/>
                                                </GeometryGroup>
                                            </Path.Data>
                                        </Path>
                                    </Button>
                                </Grid>
                                <controls:ProgressBar x:Name="PART_ProgressBar" Background="{DynamicResource TransparentBrush}" Grid.ColumnSpan="4" Grid.Column="0" Height="{Binding (params:General.BoldThicknessValue), Mode=OneWay, RelativeSource={RelativeSource Self}}" Grid.Row="0" Value="{TemplateBinding Progress}" VerticalAlignment="Top"/>
                            </Grid>
                            <AdornerDecorator RenderOptions.ClearTypeHint="{TemplateBinding RenderOptions.ClearTypeHint}" Grid.Row="1" TextOptions.TextRenderingMode="{TemplateBinding TextOptions.TextRenderingMode}" TextOptions.TextFormattingMode="{TemplateBinding TextOptions.TextFormattingMode}">
                                <ContentPresenter ContentTemplate="{TemplateBinding ContentTemplate}" Content="{TemplateBinding Content}" ContentStringFormat="{TemplateBinding ContentStringFormat}" Margin="{TemplateBinding Padding}"/>
                            </AdornerDecorator>
                            <Decorator controls:Window.IsApplicationBarHost="True" Grid.Row="1"/>
                            <ResizeGrip x:Name="PART_Grip" HorizontalAlignment="Right" IsTabStop="False" Grid.Row="1" WindowChrome.ResizeGripDirection="BottomRight" Visibility="Collapsed" VerticalAlignment="Bottom"/>
                        </Grid>
                    </Border>
                    <ControlTemplate.Triggers>
                        <DataTrigger>
                            <DataTrigger.Binding>
                                <Binding Converter="{StaticResource IsGreaterThanConverter}" ConverterParameter="18" Mode="OneWay" Path="(params:General.TitleFontSize)" RelativeSource="{RelativeSource Self}"/>
                            </DataTrigger.Binding>
                            <Setter Property="TextOptions.TextFormattingMode" TargetName="PART_Title" Value="Ideal"/>
                        </DataTrigger>
                        <Trigger Property="IsBusy" Value="True">
                            <Setter Property="State" TargetName="PART_ProgressBar" Value="Indeterminate"/>
                        </Trigger>
                        <Trigger Property="controls:Window.IsMainWindow" Value="True">
                            <Setter Property="Background" TargetName="PART_Caption" Value="{DynamicResource AccentBrush}"/>
                            <Setter Property="Foreground" TargetName="PART_ProgressBar" Value="{DynamicResource ContrastBrush}"/>
                            <Setter Property="Foreground" TargetName="PART_Title" Value="{DynamicResource ContrastBrush}"/>
                            <Setter Property="Style" TargetName="PART_Minimize">
                                <Setter.Value>
                                    <Style TargetType="{x:Type Button}">
                                        <Setter Property="Background" Value="{DynamicResource AccentBrush}"/>
                                        <Setter Property="BorderBrush" Value="{DynamicResource AccentBrush}"/>
                                        <Setter Property="Foreground" Value="{DynamicResource ContrastBrush}"/>
                                        <Setter Property="FocusVisualStyle" Value="{x:Null}"/>
                                        <Setter Property="IsTabStop" Value="False"/>
                                        <Setter Property="MinWidth" Value="32"/>
                                        <Setter Property="MinHeight" Value="32"/>
                                        <Setter Property="ToolTipService.ShowOnDisabled" Value="True"/>
                                        <Style.BasedOn>
                                            <Style TargetType="{x:Type Button}">
                                                <Style.BasedOn>
                                                    <Style TargetType="{x:Type ButtonBase}">
                                                        <Setter Property="Background" Value="#FF017BCD"/>
                                                        <Setter Property="BorderBrush" Value="#FF017BCD"/>
                                                        <Setter Property="BorderThickness" Value="{Binding (params:General.DefaultThickness), Mode=OneWay, RelativeSource={RelativeSource Self}}"/>
                                                        <Setter Property="Foreground" Value="White"/>
                                                        <Setter Property="FontSize" Value="{Binding (params:General.ContentFontSize), Mode=OneWay, RelativeSource={RelativeSource Self}}"/>
                                                        <Setter Property="FontStretch" Value="Normal"/>
                                                        <Setter Property="FontStyle" Value="Normal"/>
                                                        <Setter Property="FontWeight" Value="SemiBold"/>
                                                        <Setter Property="TextOptions.TextFormattingMode" Value="Display"/>
                                                        <Setter Property="TextOptions.TextRenderingMode" Value="ClearType"/>
                                                        <Setter Property="RenderOptions.ClearTypeHint" Value="Enabled"/>
                                                        <Setter Property="Focusable" Value="True"/>
                                                        <Setter Property="FocusVisualStyle">
                                                            <Setter.Value>
                                                                <Style TargetType="{x:Type Control}">
                                                                    <Setter Property="Template">
                                                                        <Setter.Value>
                                                                            <ControlTemplate>
                                                                                <Rectangle RenderOptions.EdgeMode="Aliased" Margin="{TemplateBinding params:General.DefaultPadding}" Stroke="Black" StrokeThickness="{TemplateBinding params:General.DefaultThicknessValue}" StrokeDashArray="2 1"/>
                                                                            </ControlTemplate>
                                                                        </Setter.Value>
                                                                    </Setter>
                                                                </Style>
                                                            </Setter.Value>
                                                        </Setter>
                                                        <Setter Property="HorizontalContentAlignment" Value="Center"/>
                                                        <Setter Property="VerticalContentAlignment" Value="Center"/>
                                                        <Setter Property="Padding" Value="{Binding (params:General.BoldPadding), Mode=OneWay, RelativeSource={RelativeSource Self}}"/>
                                                        <Setter Property="MinWidth" Value="70"/>
                                                        <Setter Property="SnapsToDevicePixels" Value="True"/>
                                                        <Setter Property="Template">
                                                            <Setter.Value>
                                                                <ControlTemplate TargetType="{x:Type ButtonBase}">
                                                                    <Border BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}" RenderOptions.ClearTypeHint="{TemplateBinding RenderOptions.ClearTypeHint}" TextElement.Foreground="{TemplateBinding Foreground}" TextElement.FontWeight="{TemplateBinding FontWeight}" TextElement.FontStyle="{TemplateBinding FontStyle}" TextElement.FontStretch="{TemplateBinding FontStretch}" TextElement.FontSize="{TemplateBinding FontSize}" TextElement.FontFamily="{TemplateBinding FontFamily}" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" TextOptions.TextRenderingMode="{TemplateBinding TextOptions.TextRenderingMode}" TextOptions.TextFormattingMode="{TemplateBinding TextOptions.TextFormattingMode}">
                                                                        <ContentPresenter ContentTemplate="{TemplateBinding ContentTemplate}" Content="{TemplateBinding Content}" ContentStringFormat="{TemplateBinding ContentStringFormat}" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" Margin="{TemplateBinding Padding}" RecognizesAccessKey="True" VerticalAlignment="{TemplateBinding VerticalContentAlignment}"/>
                                                                    </Border>
                                                                </ControlTemplate>
                                                            </Setter.Value>
                                                        </Setter>
                                                        <Style.Triggers>
                                                            <DataTrigger>
                                                                <DataTrigger.Binding>
                                                                    <Binding Converter="{StaticResource IsGreaterThanConverter}" ConverterParameter="18" Mode="OneWay" Path="FontSize" RelativeSource="{RelativeSource Self}"/>
                                                                </DataTrigger.Binding>
                                                                <Setter Property="TextOptions.TextFormattingMode" Value="Ideal"/>
                                                            </DataTrigger>
                                                            <Trigger Property="IsMouseOver" Value="True">
                                                                <Setter Property="Background" Value="Black"/>
                                                                <Setter Property="BorderBrush" Value="Black"/>
                                                                <Setter Property="Foreground" Value="White"/>
                                                            </Trigger>
                                                            <Trigger Property="IsPressed" Value="True">
                                                                <Setter Property="Background" Value="#FF4D4D4D"/>
                                                                <Setter Property="BorderBrush" Value="#FF4D4D4D"/>
                                                                <Setter Property="Foreground" Value="White"/>
                                                            </Trigger>
                                                            <Trigger Property="IsEnabled" Value="False">
                                                                <Setter Property="Background" Value="#FFB8B5B2"/>
                                                                <Setter Property="BorderBrush" Value="#FFB8B5B2"/>
                                                                <Setter Property="Foreground" Value="White"/>
                                                            </Trigger>
                                                        </Style.Triggers>
                                                    </Style>
                                                </Style.BasedOn>
                                                <Style.Triggers>
                                                    <Trigger Property="IsDefault" Value="True">
                                                        <Setter Property="FontWeight" Value="Bold"/>
                                                    </Trigger>
                                                </Style.Triggers>
                                            </Style>
                                        </Style.BasedOn>
                                        <Style.Triggers>
                                            <Trigger Property="IsMouseOver" Value="True">
                                                <Setter Property="Background" Value="{DynamicResource SemitransparentContrastBrush}"/>
                                                <Setter Property="BorderBrush" Value="{DynamicResource SemitransparentContrastBrush}"/>
                                                <Setter Property="Foreground" Value="{DynamicResource ContrastBrush}"/>
                                            </Trigger>
                                            <Trigger Property="IsPressed" Value="True">
                                                <Setter Property="Background" Value="{DynamicResource ContrastBrush}"/>
                                                <Setter Property="BorderBrush" Value="{DynamicResource ContrastBrush}"/>
                                                <Setter Property="Foreground" Value="{DynamicResource AccentBrush}"/>
                                            </Trigger>
                                        </Style.Triggers>
                                    </Style>
                                </Setter.Value>
                            </Setter>
                            <Setter Property="Style" TargetName="PART_Maximize">
                                <Setter.Value>
                                    <Style TargetType="{x:Type Button}">
                                        <Setter Property="Background" Value="{DynamicResource AccentBrush}"/>
                                        <Setter Property="BorderBrush" Value="{DynamicResource AccentBrush}"/>
                                        <Setter Property="Foreground" Value="{DynamicResource ContrastBrush}"/>
                                        <Setter Property="FocusVisualStyle" Value="{x:Null}"/>
                                        <Setter Property="IsTabStop" Value="False"/>
                                        <Setter Property="MinWidth" Value="32"/>
                                        <Setter Property="MinHeight" Value="32"/>
                                        <Setter Property="ToolTipService.ShowOnDisabled" Value="True"/>
                                        <Style.BasedOn>
                                            <Style TargetType="{x:Type Button}">
                                                <Style.BasedOn>
                                                    <Style TargetType="{x:Type ButtonBase}">
                                                        <Setter Property="Background" Value="#FF017BCD"/>
                                                        <Setter Property="BorderBrush" Value="#FF017BCD"/>
                                                        <Setter Property="BorderThickness" Value="{Binding (params:General.DefaultThickness), Mode=OneWay, RelativeSource={RelativeSource Self}}"/>
                                                        <Setter Property="Foreground" Value="White"/>
                                                        <Setter Property="FontSize" Value="{Binding (params:General.ContentFontSize), Mode=OneWay, RelativeSource={RelativeSource Self}}"/>
                                                        <Setter Property="FontStretch" Value="Normal"/>
                                                        <Setter Property="FontStyle" Value="Normal"/>
                                                        <Setter Property="FontWeight" Value="SemiBold"/>
                                                        <Setter Property="TextOptions.TextFormattingMode" Value="Display"/>
                                                        <Setter Property="TextOptions.TextRenderingMode" Value="ClearType"/>
                                                        <Setter Property="RenderOptions.ClearTypeHint" Value="Enabled"/>
                                                        <Setter Property="Focusable" Value="True"/>
                                                        <Setter Property="FocusVisualStyle">
                                                            <Setter.Value>
                                                                <Style TargetType="{x:Type Control}">
                                                                    <Setter Property="Template">
                                                                        <Setter.Value>
                                                                            <ControlTemplate>
                                                                                <Rectangle RenderOptions.EdgeMode="Aliased" Margin="{TemplateBinding params:General.DefaultPadding}" Stroke="Black" StrokeThickness="{TemplateBinding params:General.DefaultThicknessValue}" StrokeDashArray="2 1"/>
                                                                            </ControlTemplate>
                                                                        </Setter.Value>
                                                                    </Setter>
                                                                </Style>
                                                            </Setter.Value>
                                                        </Setter>
                                                        <Setter Property="HorizontalContentAlignment" Value="Center"/>
                                                        <Setter Property="VerticalContentAlignment" Value="Center"/>
                                                        <Setter Property="Padding" Value="{Binding (params:General.BoldPadding), Mode=OneWay, RelativeSource={RelativeSource Self}}"/>
                                                        <Setter Property="MinWidth" Value="70"/>
                                                        <Setter Property="SnapsToDevicePixels" Value="True"/>
                                                        <Setter Property="Template">
                                                            <Setter.Value>
                                                                <ControlTemplate TargetType="{x:Type ButtonBase}">
                                                                    <Border BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}" RenderOptions.ClearTypeHint="{TemplateBinding RenderOptions.ClearTypeHint}" TextElement.Foreground="{TemplateBinding Foreground}" TextElement.FontWeight="{TemplateBinding FontWeight}" TextElement.FontStyle="{TemplateBinding FontStyle}" TextElement.FontStretch="{TemplateBinding FontStretch}" TextElement.FontSize="{TemplateBinding FontSize}" TextElement.FontFamily="{TemplateBinding FontFamily}" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" TextOptions.TextRenderingMode="{TemplateBinding TextOptions.TextRenderingMode}" TextOptions.TextFormattingMode="{TemplateBinding TextOptions.TextFormattingMode}">
                                                                        <ContentPresenter ContentTemplate="{TemplateBinding ContentTemplate}" Content="{TemplateBinding Content}" ContentStringFormat="{TemplateBinding ContentStringFormat}" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" Margin="{TemplateBinding Padding}" RecognizesAccessKey="True" VerticalAlignment="{TemplateBinding VerticalContentAlignment}"/>
                                                                    </Border>
                                                                </ControlTemplate>
                                                            </Setter.Value>
                                                        </Setter>
                                                        <Style.Triggers>
                                                            <DataTrigger>
                                                                <DataTrigger.Binding>
                                                                    <Binding Converter="{StaticResource IsGreaterThanConverter}" ConverterParameter="18" Mode="OneWay" Path="FontSize" RelativeSource="{RelativeSource Self}"/>
                                                                </DataTrigger.Binding>
                                                                <Setter Property="TextOptions.TextFormattingMode" Value="Ideal"/>
                                                            </DataTrigger>
                                                            <Trigger Property="IsMouseOver" Value="True">
                                                                <Setter Property="Background" Value="Black"/>
                                                                <Setter Property="BorderBrush" Value="Black"/>
                                                                <Setter Property="Foreground" Value="White"/>
                                                            </Trigger>
                                                            <Trigger Property="IsPressed" Value="True">
                                                                <Setter Property="Background" Value="#FF4D4D4D"/>
                                                                <Setter Property="BorderBrush" Value="#FF4D4D4D"/>
                                                                <Setter Property="Foreground" Value="White"/>
                                                            </Trigger>
                                                            <Trigger Property="IsEnabled" Value="False">
                                                                <Setter Property="Background" Value="#FFB8B5B2"/>
                                                                <Setter Property="BorderBrush" Value="#FFB8B5B2"/>
                                                                <Setter Property="Foreground" Value="White"/>
                                                            </Trigger>
                                                        </Style.Triggers>
                                                    </Style>
                                                </Style.BasedOn>
                                                <Style.Triggers>
                                                    <Trigger Property="IsDefault" Value="True">
                                                        <Setter Property="FontWeight" Value="Bold"/>
                                                    </Trigger>
                                                </Style.Triggers>
                                            </Style>
                                        </Style.BasedOn>
                                        <Style.Triggers>
                                            <Trigger Property="IsMouseOver" Value="True">
                                                <Setter Property="Background" Value="{DynamicResource SemitransparentContrastBrush}"/>
                                                <Setter Property="BorderBrush" Value="{DynamicResource SemitransparentContrastBrush}"/>
                                                <Setter Property="Foreground" Value="{DynamicResource ContrastBrush}"/>
                                            </Trigger>
                                            <Trigger Property="IsPressed" Value="True">
                                                <Setter Property="Background" Value="{DynamicResource ContrastBrush}"/>
                                                <Setter Property="BorderBrush" Value="{DynamicResource ContrastBrush}"/>
                                                <Setter Property="Foreground" Value="{DynamicResource AccentBrush}"/>
                                            </Trigger>
                                        </Style.Triggers>
                                    </Style>
                                </Setter.Value>
                            </Setter>
                            <Setter Property="Style" TargetName="PART_Restore">
                                <Setter.Value>
                                    <Style TargetType="{x:Type Button}">
                                        <Setter Property="Background" Value="{DynamicResource AccentBrush}"/>
                                        <Setter Property="BorderBrush" Value="{DynamicResource AccentBrush}"/>
                                        <Setter Property="Foreground" Value="{DynamicResource ContrastBrush}"/>
                                        <Setter Property="FocusVisualStyle" Value="{x:Null}"/>
                                        <Setter Property="IsTabStop" Value="False"/>
                                        <Setter Property="MinWidth" Value="32"/>
                                        <Setter Property="MinHeight" Value="32"/>
                                        <Setter Property="ToolTipService.ShowOnDisabled" Value="True"/>
                                        <Style.BasedOn>
                                            <Style TargetType="{x:Type Button}">
                                                <Style.BasedOn>
                                                    <Style TargetType="{x:Type ButtonBase}">
                                                        <Setter Property="Background" Value="#FF017BCD"/>
                                                        <Setter Property="BorderBrush" Value="#FF017BCD"/>
                                                        <Setter Property="BorderThickness" Value="{Binding (params:General.DefaultThickness), Mode=OneWay, RelativeSource={RelativeSource Self}}"/>
                                                        <Setter Property="Foreground" Value="White"/>
                                                        <Setter Property="FontSize" Value="{Binding (params:General.ContentFontSize), Mode=OneWay, RelativeSource={RelativeSource Self}}"/>
                                                        <Setter Property="FontStretch" Value="Normal"/>
                                                        <Setter Property="FontStyle" Value="Normal"/>
                                                        <Setter Property="FontWeight" Value="SemiBold"/>
                                                        <Setter Property="TextOptions.TextFormattingMode" Value="Display"/>
                                                        <Setter Property="TextOptions.TextRenderingMode" Value="ClearType"/>
                                                        <Setter Property="RenderOptions.ClearTypeHint" Value="Enabled"/>
                                                        <Setter Property="Focusable" Value="True"/>
                                                        <Setter Property="FocusVisualStyle">
                                                            <Setter.Value>
                                                                <Style TargetType="{x:Type Control}">
                                                                    <Setter Property="Template">
                                                                        <Setter.Value>
                                                                            <ControlTemplate>
                                                                                <Rectangle RenderOptions.EdgeMode="Aliased" Margin="{TemplateBinding params:General.DefaultPadding}" Stroke="Black" StrokeThickness="{TemplateBinding params:General.DefaultThicknessValue}" StrokeDashArray="2 1"/>
                                                                            </ControlTemplate>
                                                                        </Setter.Value>
                                                                    </Setter>
                                                                </Style>
                                                            </Setter.Value>
                                                        </Setter>
                                                        <Setter Property="HorizontalContentAlignment" Value="Center"/>
                                                        <Setter Property="VerticalContentAlignment" Value="Center"/>
                                                        <Setter Property="Padding" Value="{Binding (params:General.BoldPadding), Mode=OneWay, RelativeSource={RelativeSource Self}}"/>
                                                        <Setter Property="MinWidth" Value="70"/>
                                                        <Setter Property="SnapsToDevicePixels" Value="True"/>
                                                        <Setter Property="Template">
                                                            <Setter.Value>
                                                                <ControlTemplate TargetType="{x:Type ButtonBase}">
                                                                    <Border BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}" RenderOptions.ClearTypeHint="{TemplateBinding RenderOptions.ClearTypeHint}" TextElement.Foreground="{TemplateBinding Foreground}" TextElement.FontWeight="{TemplateBinding FontWeight}" TextElement.FontStyle="{TemplateBinding FontStyle}" TextElement.FontStretch="{TemplateBinding FontStretch}" TextElement.FontSize="{TemplateBinding FontSize}" TextElement.FontFamily="{TemplateBinding FontFamily}" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" TextOptions.TextRenderingMode="{TemplateBinding TextOptions.TextRenderingMode}" TextOptions.TextFormattingMode="{TemplateBinding TextOptions.TextFormattingMode}">
                                                                        <ContentPresenter ContentTemplate="{TemplateBinding ContentTemplate}" Content="{TemplateBinding Content}" ContentStringFormat="{TemplateBinding ContentStringFormat}" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" Margin="{TemplateBinding Padding}" RecognizesAccessKey="True" VerticalAlignment="{TemplateBinding VerticalContentAlignment}"/>
                                                                    </Border>
                                                                </ControlTemplate>
                                                            </Setter.Value>
                                                        </Setter>
                                                        <Style.Triggers>
                                                            <DataTrigger>
                                                                <DataTrigger.Binding>
                                                                    <Binding Converter="{StaticResource IsGreaterThanConverter}" ConverterParameter="18" Mode="OneWay" Path="FontSize" RelativeSource="{RelativeSource Self}"/>
                                                                </DataTrigger.Binding>
                                                                <Setter Property="TextOptions.TextFormattingMode" Value="Ideal"/>
                                                            </DataTrigger>
                                                            <Trigger Property="IsMouseOver" Value="True">
                                                                <Setter Property="Background" Value="Black"/>
                                                                <Setter Property="BorderBrush" Value="Black"/>
                                                                <Setter Property="Foreground" Value="White"/>
                                                            </Trigger>
                                                            <Trigger Property="IsPressed" Value="True">
                                                                <Setter Property="Background" Value="#FF4D4D4D"/>
                                                                <Setter Property="BorderBrush" Value="#FF4D4D4D"/>
                                                                <Setter Property="Foreground" Value="White"/>
                                                            </Trigger>
                                                            <Trigger Property="IsEnabled" Value="False">
                                                                <Setter Property="Background" Value="#FFB8B5B2"/>
                                                                <Setter Property="BorderBrush" Value="#FFB8B5B2"/>
                                                                <Setter Property="Foreground" Value="White"/>
                                                            </Trigger>
                                                        </Style.Triggers>
                                                    </Style>
                                                </Style.BasedOn>
                                                <Style.Triggers>
                                                    <Trigger Property="IsDefault" Value="True">
                                                        <Setter Property="FontWeight" Value="Bold"/>
                                                    </Trigger>
                                                </Style.Triggers>
                                            </Style>
                                        </Style.BasedOn>
                                        <Style.Triggers>
                                            <Trigger Property="IsMouseOver" Value="True">
                                                <Setter Property="Background" Value="{DynamicResource SemitransparentContrastBrush}"/>
                                                <Setter Property="BorderBrush" Value="{DynamicResource SemitransparentContrastBrush}"/>
                                                <Setter Property="Foreground" Value="{DynamicResource ContrastBrush}"/>
                                            </Trigger>
                                            <Trigger Property="IsPressed" Value="True">
                                                <Setter Property="Background" Value="{DynamicResource ContrastBrush}"/>
                                                <Setter Property="BorderBrush" Value="{DynamicResource ContrastBrush}"/>
                                                <Setter Property="Foreground" Value="{DynamicResource AccentBrush}"/>
                                            </Trigger>
                                        </Style.Triggers>
                                    </Style>
                                </Setter.Value>
                            </Setter>
                            <Setter Property="Style" TargetName="PART_Close">
                                <Setter.Value>
                                    <Style TargetType="{x:Type Button}">
                                        <Setter Property="Background" Value="{DynamicResource AccentBrush}"/>
                                        <Setter Property="BorderBrush" Value="{DynamicResource AccentBrush}"/>
                                        <Setter Property="Foreground" Value="{DynamicResource ContrastBrush}"/>
                                        <Setter Property="FocusVisualStyle" Value="{x:Null}"/>
                                        <Setter Property="IsTabStop" Value="False"/>
                                        <Setter Property="MinWidth" Value="32"/>
                                        <Setter Property="MinHeight" Value="32"/>
                                        <Setter Property="ToolTipService.ShowOnDisabled" Value="True"/>
                                        <Style.BasedOn>
                                            <Style TargetType="{x:Type Button}">
                                                <Style.BasedOn>
                                                    <Style TargetType="{x:Type ButtonBase}">
                                                        <Setter Property="Background" Value="#FF017BCD"/>
                                                        <Setter Property="BorderBrush" Value="#FF017BCD"/>
                                                        <Setter Property="BorderThickness" Value="{Binding (params:General.DefaultThickness), Mode=OneWay, RelativeSource={RelativeSource Self}}"/>
                                                        <Setter Property="Foreground" Value="White"/>
                                                        <Setter Property="FontSize" Value="{Binding (params:General.ContentFontSize), Mode=OneWay, RelativeSource={RelativeSource Self}}"/>
                                                        <Setter Property="FontStretch" Value="Normal"/>
                                                        <Setter Property="FontStyle" Value="Normal"/>
                                                        <Setter Property="FontWeight" Value="SemiBold"/>
                                                        <Setter Property="TextOptions.TextFormattingMode" Value="Display"/>
                                                        <Setter Property="TextOptions.TextRenderingMode" Value="ClearType"/>
                                                        <Setter Property="RenderOptions.ClearTypeHint" Value="Enabled"/>
                                                        <Setter Property="Focusable" Value="True"/>
                                                        <Setter Property="FocusVisualStyle">
                                                            <Setter.Value>
                                                                <Style TargetType="{x:Type Control}">
                                                                    <Setter Property="Template">
                                                                        <Setter.Value>
                                                                            <ControlTemplate>
                                                                                <Rectangle RenderOptions.EdgeMode="Aliased" Margin="{TemplateBinding params:General.DefaultPadding}" Stroke="Black" StrokeThickness="{TemplateBinding params:General.DefaultThicknessValue}" StrokeDashArray="2 1"/>
                                                                            </ControlTemplate>
                                                                        </Setter.Value>
                                                                    </Setter>
                                                                </Style>
                                                            </Setter.Value>
                                                        </Setter>
                                                        <Setter Property="HorizontalContentAlignment" Value="Center"/>
                                                        <Setter Property="VerticalContentAlignment" Value="Center"/>
                                                        <Setter Property="Padding" Value="{Binding (params:General.BoldPadding), Mode=OneWay, RelativeSource={RelativeSource Self}}"/>
                                                        <Setter Property="MinWidth" Value="70"/>
                                                        <Setter Property="SnapsToDevicePixels" Value="True"/>
                                                        <Setter Property="Template">
                                                            <Setter.Value>
                                                                <ControlTemplate TargetType="{x:Type ButtonBase}">
                                                                    <Border BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}" RenderOptions.ClearTypeHint="{TemplateBinding RenderOptions.ClearTypeHint}" TextElement.Foreground="{TemplateBinding Foreground}" TextElement.FontWeight="{TemplateBinding FontWeight}" TextElement.FontStyle="{TemplateBinding FontStyle}" TextElement.FontStretch="{TemplateBinding FontStretch}" TextElement.FontSize="{TemplateBinding FontSize}" TextElement.FontFamily="{TemplateBinding FontFamily}" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" TextOptions.TextRenderingMode="{TemplateBinding TextOptions.TextRenderingMode}" TextOptions.TextFormattingMode="{TemplateBinding TextOptions.TextFormattingMode}">
                                                                        <ContentPresenter ContentTemplate="{TemplateBinding ContentTemplate}" Content="{TemplateBinding Content}" ContentStringFormat="{TemplateBinding ContentStringFormat}" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" Margin="{TemplateBinding Padding}" RecognizesAccessKey="True" VerticalAlignment="{TemplateBinding VerticalContentAlignment}"/>
                                                                    </Border>
                                                                </ControlTemplate>
                                                            </Setter.Value>
                                                        </Setter>
                                                        <Style.Triggers>
                                                            <DataTrigger>
                                                                <DataTrigger.Binding>
                                                                    <Binding Converter="{StaticResource IsGreaterThanConverter}" ConverterParameter="18" Mode="OneWay" Path="FontSize" RelativeSource="{RelativeSource Self}"/>
                                                                </DataTrigger.Binding>
                                                                <Setter Property="TextOptions.TextFormattingMode" Value="Ideal"/>
                                                            </DataTrigger>
                                                            <Trigger Property="IsMouseOver" Value="True">
                                                                <Setter Property="Background" Value="Black"/>
                                                                <Setter Property="BorderBrush" Value="Black"/>
                                                                <Setter Property="Foreground" Value="White"/>
                                                            </Trigger>
                                                            <Trigger Property="IsPressed" Value="True">
                                                                <Setter Property="Background" Value="#FF4D4D4D"/>
                                                                <Setter Property="BorderBrush" Value="#FF4D4D4D"/>
                                                                <Setter Property="Foreground" Value="White"/>
                                                            </Trigger>
                                                            <Trigger Property="IsEnabled" Value="False">
                                                                <Setter Property="Background" Value="#FFB8B5B2"/>
                                                                <Setter Property="BorderBrush" Value="#FFB8B5B2"/>
                                                                <Setter Property="Foreground" Value="White"/>
                                                            </Trigger>
                                                        </Style.Triggers>
                                                    </Style>
                                                </Style.BasedOn>
                                                <Style.Triggers>
                                                    <Trigger Property="IsDefault" Value="True">
                                                        <Setter Property="FontWeight" Value="Bold"/>
                                                    </Trigger>
                                                </Style.Triggers>
                                            </Style>
                                        </Style.BasedOn>
                                        <Style.Triggers>
                                            <Trigger Property="IsMouseOver" Value="True">
                                                <Setter Property="Background" Value="{DynamicResource SemitransparentContrastBrush}"/>
                                                <Setter Property="BorderBrush" Value="{DynamicResource SemitransparentContrastBrush}"/>
                                                <Setter Property="Foreground" Value="{DynamicResource ContrastBrush}"/>
                                            </Trigger>
                                            <Trigger Property="IsPressed" Value="True">
                                                <Setter Property="Background" Value="{DynamicResource ContrastBrush}"/>
                                                <Setter Property="BorderBrush" Value="{DynamicResource ContrastBrush}"/>
                                                <Setter Property="Foreground" Value="{DynamicResource AccentBrush}"/>
                                            </Trigger>
                                        </Style.Triggers>
                                    </Style>
                                </Setter.Value>
                            </Setter>
                        </Trigger>
                        <Trigger Property="WindowState" Value="Maximized">
                            <Setter Property="Visibility" TargetName="PART_Maximize" Value="Hidden"/>
                            <Setter Property="Visibility" TargetName="PART_Restore" Value="Visible"/>
                        </Trigger>
                        <Trigger Property="WindowStyle" Value="None">
                            <Setter Property="Visibility" TargetName="PART_Title" Value="Collapsed"/>
                            <Setter Property="Visibility" TargetName="PART_Minimize" Value="Collapsed"/>
                            <Setter Property="Visibility" TargetName="PART_Maximize" Value="Collapsed"/>
                            <Setter Property="Visibility" TargetName="PART_Restore" Value="Collapsed"/>
                            <Setter Property="Visibility" TargetName="PART_Close" Value="Collapsed"/>
                        </Trigger>
                        <Trigger Property="WindowStyle" Value="ToolWindow">
                            <Setter Property="Visibility" TargetName="PART_Minimize" Value="Collapsed"/>
                            <Setter Property="Visibility" TargetName="PART_Maximize" Value="Collapsed"/>
                            <Setter Property="Visibility" TargetName="PART_Restore" Value="Collapsed"/>
                        </Trigger>
                        <Trigger Property="ResizeMode" Value="NoResize">
                            <Setter Property="Visibility" TargetName="PART_Minimize" Value="Collapsed"/>
                            <Setter Property="Visibility" TargetName="PART_Maximize" Value="Collapsed"/>
                            <Setter Property="Visibility" TargetName="PART_Restore" Value="Collapsed"/>
                        </Trigger>
                        <Trigger Property="ResizeMode" Value="CanMinimize">
                            <Setter Property="Visibility" TargetName="PART_Maximize" Value="Collapsed"/>
                            <Setter Property="Visibility" TargetName="PART_Restore" Value="Collapsed"/>
                        </Trigger>
                        <Trigger Property="ResizeMode" Value="CanResizeWithGrip">
                            <Setter Property="Visibility" TargetName="PART_Grip" Value="Visible"/>
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
        <Style.Triggers>
            <DataTrigger>
                <DataTrigger.Binding>
                    <Binding Converter="{StaticResource IsGreaterThanConverter}" ConverterParameter="18" Mode="OneWay" Path="FontSize" RelativeSource="{RelativeSource Self}"/>
                </DataTrigger.Binding>
                <Setter Property="TextOptions.TextFormattingMode" Value="Ideal"/>
            </DataTrigger>
            <Trigger Property="HasDropShadow" Value="False">
                <Setter Property="BorderThickness" Value="{Binding (params:General.DefaultThickness), Mode=OneWay, RelativeSource={RelativeSource Self}}"/>
            </Trigger>
            <Trigger Property="WindowStyle" Value="None">
                <Setter Property="ResizeMode" Value="NoResize"/>
            </Trigger>
            <Trigger Property="WindowStyle" Value="ToolWindow">
                <Setter Property="ResizeMode" Value="NoResize"/>
            </Trigger>
        </Style.Triggers>
    </Style>
</ResourceDictionary>